The breadcrumbs do not show the news page

#66176
  • Resolved Anonymous
    Rank Math free

    Hello,
    the breadcrumbs don’t show me the news page, can you help me?
    thank you

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello,

    Thank you for getting in touch

    You don’t seem to have added the provided breadcrumbs function
    <?php if (function_exists('rank_math_the_breadcrumbs')) rank_math_the_breadcrumbs(); ?>
    or the shortcode [rank_math_breadcrumb] to generate the breadcrumb in the front-end of your page.

    I added the shortcode on your news page for testing and it seems to appear just fine, please check the screenshot I have attached in the sensitive section.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Anonymous
    Rank Math free

    No, the problem is not on that page but on the individual news .. see the link I have attached
    Thanks for your help

    Hello,

    I have noted the issue. Allow me to consult on this and get back to you.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Anonymous
    Rank Math free

    thanks then I await news

    Hi Marco,

    I am getting this while trying to access the page:

    Is your website under maintenance?

    Anonymous
    Rank Math free

    it is under construction, I left you the data to access ..
    thank you

    Alberto
    Rank Math business

    Hello,

    You are using the WP News and Scrolling Widgets plugin, which is creating a custom post type (‘news’) and a custom URL (‘/news’) but it is not adding the news posts to a category called ‘news’, that is why you don’t see the category “News” added to the news posts in the breadcrumbs.

    I coded a little snippet to add compatibility with the WP News and Scrolling Widgets plugin and the breadcrumbs, I have already added it to your website and as you can see everything is working fine, but I will also share it here so it helps any other user experiencing the same issue:

    /**
     * Allow Breadcrumbs compatibility with the 'WP News and Scrolling Widgets' plugin
     *
     * @param array       $crumbs The crumbs array.
     * @param Breadcrumbs $this   Current breadcrumb object.
     */
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	$ret = $crumbs;
    	if(is_single() && get_post_type()=='news'){
        		$mainCategory = array(
    				"0"=>esc_html('News'),
    				"1"=>esc_url('/news'),
    				"hide_in_scheme"=>false
    			);  
    			
    			array_splice($ret, 1, 0, array($mainCategory)); 
    	}
    	return $ret;
    }, 10, 2);

    Looking forward to help you.

    Anonymous
    Rank Math free

    Perfect! thank you very much!

    Hello,

    We are glad this resolved your issue. Can we set the thread as resolved?

    If you have any further question(s), please let us know. Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)

You must be logged in to reply to this ticket.