Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #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,

    #1365326

    Hi 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,
    Nikko

    #1365330

    Yes, 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?

    #1365340

    Hi,
    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,
    Mike

    #1365373

    Mike and Nikko,
    Thank you for more detail. I updated the code, and the short code works perfectly.
    Pleas close the thread.
    Best regards,
    Kazeko

    #1365374

    How 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' );
    #1365377

    Hi 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

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Breadcrumbs short code does't work on 5.1.2’ is closed to new replies.