Just encapsulate the content you want to show only to logged in users or or…
Enym „Autobutton“ Shortcode
// Add Shortcode
function enym_autobutton( $atts ) {
// Attributes
$atts = shortcode_atts(
array(
'label' => '',
'class' => '',
'link'=>''
),
$atts
);
global $post;
//$terms = wp_get_post_terms( $atts['post_id'], $atts['taxonomy']);
//$term = get_term( '24', 'objektart' );
$terms = wp_get_post_terms( $post->ID, 'objektart' );
//print_r($terms);
$tax = $terms[0]->term_id;
$name = $terms[0]->name;
$link = '<a href="';
if ($tax == 23) { //Gewerbe
$link .= 'mailto:ukaplan@kvb-hamburg.de?subject=Anfrage%20Gewerbe';
$label = 'Anfrage: '.$name;
} else if ($tax == 24) { //Wohnen
$link .= 'mailto:pglamann@kvb-hamburg.de?subject=Anfrage%20Wohnen';
$label = 'Anfrage: '.$name;
} else { //no tax
$link .= '/kontakt';
$label = 'Jetzt anfragen';
return;
}
$link .= '" class="autobutton vcex-button theme-txt-link align-right inline arrow-right arrow-blue"><span class="vcex-button-inner theme-button-inner">'.$label.'</span></a>';
return $link;
}
add_shortcode( 'autobutton', 'enym_autobutton' );
Dieser Beitrag hat 0 Kommentare