Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nuriye/aa991d12225d739a81e6aeb43325a439 to your computer and use it in GitHub Desktop.
Save nuriye/aa991d12225d739a81e6aeb43325a439 to your computer and use it in GitHub Desktop.
add_filter( 'vc_gitem_template_attribute_event_button', 'vc_gitem_template_attribute_event_button', 10, 2 );
function vc_gitem_template_attribute_event_button( $value, $data ) {
extract( array_merge( array(
'post' => null,
'data' => '',
), $data ) );
$event_link = get_field( "event_link", $post->ID );
$event_button_text = get_field( "event_button_text", $post->ID );
return "<button class='btn btn-primary btn-events'><a href='$event_link' target='_blank'>$event_button_text</a></div>";
}
add_shortcode( 'wps_event_link', 'vc_event_button_render' );
function vc_event_button_render($atts, $content, $tag) {
return '{{event_button}}';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment