-
AuthorPosts
-
September 16, 2022 at 5:43 am #1365206
Hello,
I have a problem about breadcrumbs short code on version 5.1.2.
I put this code on function.php in child theme.function av_breadcrumbs_shortcode( $atts ) { return Avia_Breadcrumb_Trail()->get_trail( array( 'separator' => '/', 'richsnippet' => true ) ); } add_shortcode( 'av_breadcrumbs', 'av_breadcrumbs_shortcode' );
And then, I put [av_breadcrumbs] on a page and the page was broken.
I share the error code on private section, it seems to say the code is reason of error.I beg your help.
Best,
September 17, 2022 at 12:01 pm #1365326Hi kazeko,
Thanks for posting both the code as well as the error.
The code should still work, however, the error is pointing to this function avia_breadcrumbs which is not used anymore.
Can you try to check in line 17 of your functions.php file if this code shows up:function av_breadcrumbs_shortcode( $atts ) { return avia_breadcrumbs(array('separator' => '/', 'richsnippet' => true)); } add_shortcode( 'av_breadcrumbs', 'av_breadcrumbs_shortcode' );
If yes, please try to remove it.
If not, then please give us temporary admin access.Best regards,
NikkoSeptember 17, 2022 at 12:26 pm #1365330Yes, there are same code on function.php because I put it. I deleted the code, and the text [av_breadcrumbs] was appeared on my page.
How should I change the short code to breadcrumbs?September 17, 2022 at 2:19 pm #1365340Hi,
Please note that the code you posted and the code Nikko posted are two different codes, so this code that was on line 17 in your functions.php is not correct and will cause the error, if you see it please remove:function av_breadcrumbs_shortcode( $atts ) { return avia_breadcrumbs(array('separator' => '/', 'richsnippet' => true)); } add_shortcode( 'av_breadcrumbs', 'av_breadcrumbs_shortcode' );
this is the correct code that you should add to your child theme functions.php so that your shortcode will work:
function av_breadcrumbs_shortcode( $atts ) { return Avia_Breadcrumb_Trail()->get_trail( array( 'separator' => '/', 'richsnippet' => true ) ); } add_shortcode( 'av_breadcrumbs', 'av_breadcrumbs_shortcode' );
If you are not using a child theme then you can add this to your parent theme functions.php, but note that it will be lost when to update.
If you still have trouble then please include admin login in the Private Content area so we can be of more assistance.Best regards,
MikeSeptember 18, 2022 at 3:51 am #1365373Mike and Nikko,
Thank you for more detail. I updated the code, and the short code works perfectly.
Pleas close the thread.
Best regards,
KazekoSeptember 18, 2022 at 8:04 am #1365374How should I change the short code to breadcrumbs?
the shortcode name is the first part on the add_shortcode line.
So if you like to use only [shortcode] take mikes last snippet and only change that first part:function av_breadcrumbs_shortcode( $atts ) { return Avia_Breadcrumb_Trail()->get_trail( array( 'separator' => '/', 'richsnippet' => true ) ); } add_shortcode( 'breadcrumbs', 'av_breadcrumbs_shortcode' );
September 18, 2022 at 8:40 am #1365377Hi Kazeko,
We’re glad that we could help you :)
Thanks for using Enfold and have a great weekend!
@Guenni007 thanks for helping out :)Best regards,
Nikko -
AuthorPosts
- The topic ‘Breadcrumbs short code does't work on 5.1.2’ is closed to new replies.