Site logo

[Resolved] Adding breadcrumbs without Yoast

Home Forums Support [Resolved] Adding breadcrumbs without Yoast

Home Forums Support Adding breadcrumbs without Yoast

  • This topic has 3 replies, 2 voices, and was last updated 4 years ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2231965
    Sneaky

    First, adding a breadcrumbs option in the customiser makes more sense than suggesting that you use another plugin, especially Yoast.

    Before I go off and look for some other alternatives, are there any other known ways to get this to work without a third-party plugin?

    #2232062
    David
    Staff
    Customer Support

    Hi there,

    for a really basic breadcrumb you can:

    1. Create a new Hook Element
    1.1 In the hook text area add:

    <?php
    function get_breadcrumb() {
        echo '<a href="'.home_url().'" rel="nofollow">Home</a>';
        if ( is_category() || is_single() ){
            echo "  »  ";
            the_category (' • ');
            if ( is_single() ) {
                echo " » ";
                the_title();
            }
        } elseif ( is_page() ) {
            echo " » ";
            echo the_title();
        }
    }
    get_breadcrumb();
    ?>

    1.2 Set the Hook to where you want it to appear eg. generate_before_main_content
    See here for other general hooks:
    https://docs.generatepress.com/article/hooks-visual-guide/

    1.3 Check Execute PHP
    1.4 Set the Display Rules to where you want it displayed
    eg. Posts > All Posts, Pages > All Pages, Category Archives > All Categories.

    Alternatively use a dedicated plugin – theres a few to choose from:

    https://wordpress.org/plugins/breadcrumb-navxt/
    https://wordpress.org/plugins/flexy-breadcrumb/
    https://wordpress.org/plugins/breadcrumb/

    The advantage of the plugin is they will handle custom permalink structures, custom taxonomies/post types and other advanced stuff – some including adding schema

    #2232806
    Sneaky

    Thanks, I have gone with a plugin. Maybe you can look at adding this in a new release soon. Most other similar themes similar to yours (functions wide) have this as standard.

    #2233163
    David
    Staff
    Customer Support

    Glad to hear you have something that works for you. And thanks for the suggestion!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.