WordPress Multisites Issue.

#851447
  • Resolved Visionary Minds
    Rank Math free

    I am using wordpress multisites with subdirectrory using same theme with child-theme.

    By default root main is not included in Breadcrumb how can I add Root site then subdirectory then its pages 1,2,3.

    How could it possible?

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

    We apologize for the issue you are facing with the breadcrumbs in your WordPress multisite setup. To include the root site in your breadcrumbs along with the subdirectory and its pages, you may need to customize the breadcrumb functionality.

    Unfortunately, the context provided does not contain specific instructions on modifying breadcrumbs for a multisite setup. However, you can achieve this by using a custom function in your child theme’s functions.php file.

    Here’s a general approach you can take:

    1. Create a Custom Breadcrumb Function: You can create a custom function that generates the breadcrumb trail including the root site.
    2. Modify the Existing Breadcrumbs: Use the rank_math_the_breadcrumbs function to modify how breadcrumbs are displayed. You might need to hook into it and adjust the output to include the root site.

    Here’s a sample code snippet that you can start with:

    function custom_breadcrumbs() {
        // Display root site link
        echo 'Root Site > ';
        // Call Rank Math's breadcrumb function
        if (function_exists('rank_math_the_breadcrumbs')) {
            rank_math_the_breadcrumbs();
        }
    }
    1. Add This Function to Your Template: Call this custom_breadcrumbs() function in your theme template files where you want the breadcrumbs to appear.

    Please note that modifying theme files can be tricky, and we recommend using a child theme to avoid losing changes during updates. If you’re unsure about making these changes, you might want to consult with a developer or reach out to our support team for further assistance.

    Thank you for raising this concern, and we hope this helps you set up your breadcrumbs as desired!

    Its showing

    <nav aria-label=”breadcrumbs” class=”rank-math-breadcrumb”><p>Business<span class=”separator”> – </span>Gold Rates in Pakistan<span class=”separator”> – </span><span class=”last”>Today Gold Rates in Jatoi</span></p></nav>

    Still not root domain https://jobaathai.com is showing

    Hello,

    The root domain is not added to the subsite’s breadcrumbs by default.

    In this case, you may need to use and customize this filter on your site to add the root domain to the subsite:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    $root[] = array(
    		'Root', // change to the name you want to show
                    'https://jobaathai.com/', 
                    'hide_in_schema' => false
    		);
    		array_splice( $crumbs, 0, 0, $root ); 
    	return $crumbs; 
    }, 10, 2);

    If you’re not sure how to add this code, you can follow this guide:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps.

    wOw..! Great Its worked Thank you so so much

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘WordPress Multisites Issue.’ is closed to new replies.