Skip to content

Instantly share code, notes, and snippets.

@gilzow
Created August 20, 2019 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilzow/598b1fdd6e42c968da77957061ba3f8e to your computer and use it in GitHub Desktop.
Save gilzow/598b1fdd6e42c968da77957061ba3f8e to your computer and use it in GitHub Desktop.
referenced breadcrumb code vc_templates/breadcrumb.php
<?php
/*
Element Description: VC Info Box
*/
// Element Class
class vcbreadcrumbs extends WPBakeryShortCode {
// Element Init
function __construct() {
add_action( 'init', array( $this, 'vc_breadcrumbs_mapping' ) );
add_shortcode( 'vc_breadcrumbs', array( $this, 'vc_breadcrumbs_html' ) );
}
// Element Mapping
public function vc_breadcrumbs_mapping() {
// Stop all if VC is not enabled
if ( !defined( 'WPB_VC_VERSION' ) ) {
return;
}
// Map the block with vc_map()
vc_map(
array(
'name' => __('Yoast Breadcrumbs', 'text-domain'),
'base' => 'vc_breadcrumbs',
'description' => __('Yoast Breadcrumbs', 'text-domain'),
'category' => __('My Custom Elements', 'text-domain'),
/* 'icon' => get_template_directory_uri().'/assets/img/vc-icon.png', */
'params' => array()
)
);
}
// Element HTML
public function vc_breadcrumbs_html( $atts ) {
echo '<div class="breadcrumb_container clearfix">';
if ( function_exists('yoast_breadcrumb') ) :
yoast_breadcrumb('<p class="breadcrumbs">', '</p>');
endif;
echo '</div>';
}
} // End Element Class
// Element Class Init
new vcbreadcrumbs();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment