WordPress.org

Forums

[Plugin: Breadcrumb Trail] Conflict between plugin and Hybrid theme (3 posts)

  1. billseymour
    Member
    Posted 3 years ago #

    I am using Justin Tadlock's Breadcrumb Trail plugin, works great.

    I just added the Hybrid v0.9 theme, and upon activation of Hybrid, I get:
    Cannot redeclare breadcrumb_trail() (previously declared)

    The Breadcrumb Trail plugin and the Hybrid library folder both include breadcrumb-trail.php.

    I want to experiment with Hybrid, but I don't want to have to disable a plugin (Breadcrumb Trail) every time I go to use it. Any suggestions?
    Thanks. --Bill

  2. billseymour
    Member
    Posted 3 years ago #

    One solution that appears to resolve this conflict:

    In Plugin:
    1. Search-Replace all references to 'breadcrumb_trail', replace with 'breadcrumb_trail_plugin'. So now, calling breadcrumb_trail in a theme means using 'breadcrumb_trail_plugin', rather than 'breadcrumb_trail'

    2. change the filename breadcrumb_trail.php to breadcrumb_trail_plugin.php (so that now, there is not the conflict, since Hybrid's library is using its breadcrumb_trail.php, while the Plugin uses its own breadcrumb_trail_plugin.php)

    In any Theme (other than Hybrid, of course) file using breadcrumb_trail:
    3. change all references to breadcrumb_trail to 'breadcrumb_trail_plugin', to refer to renamed function in renamed breadcrumb_trail_plugin.php

    That seems to work so far. Not too inconvenient, and it allows me to bounce between Hybrid and other themes without locking up WP.

    (Further thought: if the Plugin is updated, then the search-replace will likely have to be performed on the update so that it changed to 'breadcrumb_trail_plugin')
    --Bill

  3. billseymour
    Member
    Posted 3 years ago #

    Solution #2 (which I think might be preferable)-

    Stop using breadcrumb-trail as a plugin,
    instead add it directly via functions.php

    I placed breadcrumb-trail.php in folder library> extensions> breadcrumb-trail.php (same structure as Hybrid).

    In functions.php, I included the file following Pearsonified article about using functions.php http://www.pearsonified.com/2008/05/how-to-use-wordpress-functions.php

    include_once (TEMPLATEPATH . '/library/extensions/breadcrumb-trail.php');

    And now I can invoke breadcrumb-trail in my theme as usual.
    -----
    Advantage: no conflict between Plugin and activating Hybrid (since there is no longer a plugin, but rather each theme containing its own breadcrumb file)

    Disadvantage: The only thing I can think of is that there is not a notification of update (to a plugin), and so one might want to periodically see if a newer version of breadcrumb-trail exists.
    --Bill

Topic Closed

This topic has been closed to new replies.

About this Topic