Tagged: x
-
AuthorPosts
-
July 25, 2016 at 3:26 pm #1102451
Hi, I’m attempting to input YoastSEO’s breadcrumbs code:
<!--?php <br ?--> if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb(' <p id="breadcrumbs">','</p> '); } ?>
..to somewhere under my page title header, but I don’t know whether (or where) to add to functions.php or single.php as instructed by the video.
July 25, 2016 at 3:31 pm #1102457This reply has been marked as private.July 25, 2016 at 11:18 pm #1102893Hello There,
Thanks for writing in!
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.
Then place following code in child theme function.php file:
if ( ! function_exists( 'x_breadcrumbs' ) ) : function x_breadcrumbs() { if ( x_get_option( 'x_breadcrumb_display', 1 ) && function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } } endif;
Let us know how it goes.
Thanks.
August 24, 2016 at 10:00 pm #1145932Hi, adding on here. I just did this, but nothing changed. I still have X breadcrumbs on my layout pages and nothing showing on my no container-header-footer pages. Any other suggestions? I’ve searched around the forum quite a bit and haven’t found an answer that works. In my case, I don’t care if it’s X breadcrumbs or Yoast, I just need something that will show up on the pages I want (and not show up on some others). Suggestions welcome!
August 25, 2016 at 1:09 am #1146150Hi There,
Please try this code instead:
function x_breadcrumbs() { if ( function_exists('yoast_breadcrumb') ){ yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } }
Previous code check if Breadcrumbs is set to ON in the customizer.
Hope this helps.
August 26, 2016 at 8:46 am #1148192It still only shows on pages that use a layout, not the no container pages.
August 26, 2016 at 3:41 pm #1148766Hi there,
Yes, because they are blank templates. They have no landmark, breadcrumb, titles, comments, sidebars, and more, hence, blank templates. And you’ll have to compose or build static content on them.
Thanks!
August 26, 2016 at 5:56 pm #1148895Yes, I understand that, but it is possible to do this via CSS. I’m not really sure what is unclear about my request.
August 26, 2016 at 10:19 pm #1149240Hi there,
It’s not doable through CSS, what you’ll need is custom coding. Please add this code to your child theme’s functions.php
add_action('x_before_view__content-the-content', 'page_breadcrumbs'); function page_breadcrumbs () { if ( is_page_template( array( 'template-blank-1.php', 'template-blank-2.php', 'template-blank-3.php', 'template-blank-4.php', 'template-blank-5.php', 'template-blank-6.php', 'template-blank-7.php', 'template-blank-8.php', ) ) && function_exists('yoast_breadcrumb') ) echo '<div class="x-container max width">'.yoast_breadcrumb('<p id="breadcrumbs">','</p>').'</div>'; }
Hope this helps.
-
AuthorPosts