[Support request] Breadcrumbs type Blog David Ayala. Not Yoast SEO breadcrumbs.

Home Forums Support [Support request] Breadcrumbs type Blog David Ayala. Not Yoast SEO breadcrumbs.

Home Forums Support Breadcrumbs type Blog David Ayala. Not Yoast SEO breadcrumbs.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #766417
    Fernando

    Hi,
    I want to put “breadcrumbs” in my blog, but not the typical ones that Yoast SEO puts, but similar to the ones in David Ayala’s Blog (https://www.soywebmaster.com/david-ayala/demasiados-dominios-para-mi-body-cual-cojones-elijo/).

    There you can see how the categories are linked and even the post itself is linked to its title.

    I would like that the code or solution you give me can be inserted as a Hook or similar, so that when updating the theme is not deleted.

    I would also like to comment that I have been given a code to make these breadcrumbs, but it does not work, as I do not take the category. I put the code here for you to review:

    https://pastebin.com/WmxECmJ3

    #766831
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    It looks like that site is using Yoast to output their breadcrumbs. Have you tried Yoast to output them with no luck?

    #767454
    Fernando

    Hi Tom,

    If I’ve tried Yoast’s bread crumbs. The “problem” with Yoast bread crumbs is that it doesn’t link to the current page or category. For example, if it is within a subcategory, it only links to the category it belongs to and to the home page, but I want it to link to the subcategory as well.
    And also if for example we are in a post that is within a subcategory, I want to link both the title of the current post, as the subcategory, as the category and as the home.

    This is an essential and necessary technique for SEO.

    How can I do it?

    #767519
    Fernando

    Hi,

    I already got what I wanted, but I had to use the plugin “Breadcrumbs NavXT” and insert a Hook code in “Elements”.
    The problem now is that to insert this hook code, I had to deactivate the “edit files” box in my security plugin (so that it can run php).
    Is there any way to run php on a single hook and have the “edit files” checkbox enabled?

    #767528
    David
    Staff
    Customer Support

    Hi there,

    hmmm.. probably easier to add the function to your child theme functions file using a snippet like so:

    add_action( 'your_hook_name','example_function_name' );  
    function example_function_name() { ?> 
        Insert your hook contents in here.
    <?php }

    Guide to Hook locations / names:

    https://docs.generatepress.com/article/hooks-visual-guide/

    #768295
    Fernando

    Thank you very much David! It’s a good idea, but I can’t do it.

    It shows me the following error, and I don’t know if I did it right:
    syntax error, unexpected ‘bcn_display’ (T_STRING), expecting ‘,’ or ‘)’.

    This is the php code of the hook I want to put:
    https://pastebin.com/41Uc3aXD

    And this is the code that I have made following your indications, but it has generated the error that I have mentioned before. Let’s see if you can help me make the code work.

    //Para implementar las migas de pan en las categorias

    add_action( ‘generate_after_archive_title’,’breadcrumbs_navxt’ );
    function breadcrumbs_navxt() { ?>

    <br>
    <?php }

    Thank you very much!

    #768397
    David
    Staff
    Customer Support

    Try this:

    add_action( 'generate_after_archive_title','breadcrumbs_navxt' );  
    function breadcrumbs_navxt() { ?>
        <div class="breadcrumbs" typeof="BreadcrumbList" vocab="http://schema.org/">
        <?php if(function_exists('bcn_display'))
        {
            if(!is_home() && !is_front_page()){bcn_display();}
        }?>
    </div>
    <br>
    <?php }
    #769701
    Fernando

    Hi,

    Not found. This error appears:
    syntax error, unexpected end of file

    And what I’ve done is put in the end “the end of code php” and it hasn’t given me error. But I only got “http://schema.org/”>&#8221; in the breadcrumbs.

    So what I’ve done is put the code “https://pastebin.com/41Uc3aXD&#8221; instead of “http://schema.org/”>&#8221; and then I look good, but only in the categories that have been assigned a blog entry. In those that don’t have blog entries, bread crumbs don’t appear…

    Any ideas?

    #769987
    Tom
    Lead Developer
    Lead Developer

    What happens if you add Davids code using the Code Snippets plugin?: https://docs.generatepress.com/article/adding-php/

    #784460
    Fernando

    Hi Tom,
    It doesn’t allow me to enter David’s code into the Code Snippets plugin.

    Can you test the code and pass me the exact code for the plugin?

    #784771
    David
    Staff
    Customer Support

    Hi there,

    i tried the code in Code Snippets and no errors reported. But i don’t have the BCN function, so maybe the issue is related to that.

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