• Resolved Austin Gil

    (@aussng)


    Just found this plugin and saw your usage example:

    <div class=”breadcrumbs” typeof=”BreadcrumbList” vocab=”http://schema.org/”&gt;
    <?php if(function_exists(‘bcn_display’))
    {
    bcn_display();
    }?>
    </div>

    But shouldnt the wrapper dive be inside the conditional so that if the plugin is not installed, the extra markup wont load? So like:

    <?php if(function_exists(‘bcn_display’)) : ?>
    <div class=”breadcrumbs” typeof=”BreadcrumbList” vocab=”http://schema.org/”&gt;
    <?php bcn_display(); ?>
    </div>
    <?php endif; ?>

    https://ww.wp.xz.cn/plugins/breadcrumb-navxt/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Havlik

    (@mtekk)

    Yes, it is more correct to place the if statement around the DIV and the call to bcn_display. The current example is used for the shear simplicity and ease of reading (the correct way involves a bunch of php tags, making things less clear IMHO).

    Thread Starter Austin Gil

    (@aussng)

    Right ok. I wasn’t trying to be a dick or anything and call you out on it, I’m just a bit anal and wanted to make sure I wasn’t missing another reason it would be written like that.

    I would make one argument though, and that is a lot of people are just going to copy/paste that code. You’re absolutely right that it’s easier to read, but might also lead to unnecessary markup in other people’s sites.

    On another note, this is the first time I am using the plugin and I haven’t gotten all the way into it yet, but it looks awesome. I’ve done Yoast breadcrumbs and my own, and this looks like a much better solution. Breadcrumbs on custom post types that goes back to custom pages has been tough, but if Im not mistaken, this plugin should handle that just fine. If so, I will certainly be using it on every project ^_^

    Thanks for the nice contribution.

    Plugin Author John Havlik

    (@mtekk)

    Right ok. I wasn’t trying to be a dick or anything and call you out on it…

    Don’t worry, I didn’t take it that way at all.

    You’re absolutely right that it’s easier to read, but might also lead to unnecessary markup in other people’s sites.

    True, and the method you proposed is much better in the cases where the breadcrumb trail is not being displayed on certain pages (e.g. adding calls to one or more of the WordPress Conditionals functions).

    Thread Starter Austin Gil

    (@aussng)

    Right on. Well I got some more experience with the plugin today and it was all I hoped it would be. Sending another 5-stars your way.

    Cheers!

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

The topic ‘Shouldnt example be different?’ is closed to new replies.