Archived topic
outputting faq breadcrumb
9 replies · Started by Paul on November 20, 2021
I use Yoast and another plugin to provide a FAQ section on my website.
Using GP elements I output the breadcrumb from yoast and this works fine.
However, the FAQ plugin also outputs a breadcrumb below the header and so I end up with 2 breadcrumbs. I can disable the yoast breadcrumb for the page but the faq breadcrumb is in a different place so it looks a bit odd.
Is there any way I can output the FAQ breadcrumb in the same place where the yoast one would be?
example:
Hi there,
thats something you would need to ask the FAQ plugin author - currently that breadcrumb is displayed within the Content of the page. They may have a filter or function that will allow it to be hooked elsewhere.
Ok, what specifically do I need to ask of them (sorry I'm not familiar with the technical details of how this works)
Ask them if:
a) there is a filter to disable the breadcrumbs within the_content
b) if there is callback function we can Hook into our theme templates to display the breadcrumbs outside of the content.
Hi David,
They replied with a No for (a), but for (b)...
Yes, use the follow method:
com\cminds\cmfaq\plugin\classes\Frontend::the_breadcrumb();
Should be called after global $post is set
Would you be able to show me what I need?
Thanks for your help so far
Regards
Hi Paul,
We can easily place the same breadcrumb CM Faq uses using a Hook Element.
Add this PHP snippet on a hook element and set the hook element to Execute PHP:
<?php
CMFAQ_Frontend::the_breadcrumb();
?>
Set the hook to generate_after_header and set the display rule to Faq Questions - Al faq questions.
But the problem is we can't remove the one added within the content because it is hard coded to the plugin's post.php file.
https://share.getcloudapp.com/RBuEb1jR
If you don't mind hiding it instead of completely removing it, we can hide it with CSS.
Try this:
.entry-content .cmfaq-breadcrumb {
display: none;
}
ok, thanks, however, I tried that and it threw an error...
Fatal error: Uncaught Error: Class "CMFAQ_Frontend" not found
in /home/xxx/public_html/wp-content/plugins/gp-premium/elements/class-hooks.php(215) : eval()'d code on line 2
Call stack:
eval()
wp-content/plugins/gp-premium/elements/class-hooks.php:215
GeneratePress_Hook::execute_hook()
wp-includes/class-wp-hook.php:303
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:327
WP_Hook::do_action()
wp-includes/plugin.php:470
do_action()
wp-content/themes/generatepress/header.php:56
require_once()
wp-includes/template.php:770
load_template()
wp-includes/template.php:716
locate_template()
wp-includes/general-template.php:48
get_header()
wp-content/themes/generatepress/single.php:12
include()
wp-includes/template-loader.php:106
require_once()
wp-blog-header.php:19
require()
index.php:17
Might be best to ask the plugin author how to call that method outside of its plugin.
Hi,
The plugin supplier told me to modify the call with the full class path and it worked.
Thanks
Glad to hear that!