-
First of all, thank you so much for the free plugin that beats every other SEO plugin.
I am trying to add breadcrumbs to a customized WP Twenty Fourteen theme. I only need the breadcrumbs in Pages not Posts. So I found the header php file for the Pages; content-page.php. I would like to have the breadcrumbs appars just above the Page title just like how the theme shows categories on Pages just above the title (eg: https://sanuja.com/blog/how-to-fix-wp-error-establishing-a-database-connection). Since Pages don’t have categories, I thought this would be a perfect location.
The original code for the title is:
<?php // Page thumbnail and title. twentyfourteen_post_thumbnail(); the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></header><!-- .entry-header -->' ); ?>
Where I need to add the
rank_math_the_breadcrumbs();
is indicated by **RANK MATH BREADCRUMBS HERE** :<?php // Page thumbnail and title. twentyfourteen_post_thumbnail(); the_title('<header class="entry-header"> **RANK MATH BREADCRUMBS HERE** <h1 class="entry-title">', '</h1></header><!-- .entry-header -->' ); ?>
For some reason I am unable to do it without getting a syntax error. If I just pass the function as:
<?php // Page thumbnail and title. twentyfourteen_post_thumbnail(); if (function_exists('rank_math_the_breadcrumbs')) the_title('<header class="entry-header"> rank_math_the_breadcrumbs(); <h1 class="entry-title">', '</h1></header><!-- .entry-header -->' ); ?>
It is just going to print the rank_math_the_breadcrumbs(); as a string. You can see that here just above the title: https://sanuja.com/blog/exams/comptia-networkplus (note I have a test breadcrumb just underneath it.
Any advice on how I can integrate the function into that title string? Thank you so much. 🙂
The ticket ‘How do I add breadcrumbs function inside header class?’ is closed to new replies.