Viewing 10 replies - 1 through 10 (of 10 total)
  • Try this snippet:

    <?php    
      add_action ('zerif_after_header', 'add_breadcrumbs', 40);
      function add_breadcrumbs() {
        woocommerce_breadcrumbs();
      }
    

    You can add it to your child theme’s functions.php, or if you don’t want a child theme you can use the “My Custom Functions” plugin.

    Thread Starter eagleview

    (@eagleview)

    I installed the “My Custom Functions” plugin (great plugin), and added the
    snippet
    I get the error message ….
    ‘Sorry, but your code causes a “Fatal error”, so it is not applied! Please, check the code and try again.’

    I added the below snippet code:

    /* Enter Your Custom Functions Here */
    <?php
    add_action (‘zerif_after_header’, ‘add_breadcrumbs’, 40);
    function add_breadcrumbs() {
    woocommerce_breadcrumbs();
    }

    Any insight would be appreciated ? ??

    • This reply was modified 7 years, 6 months ago by eagleview.

    This comment line:
    /* Enter Your Custom Functions Here */
    if you want to keep it, it goes after the <?php line.

    Thread Starter eagleview

    (@eagleview)

    Hi Lorro,

    I made the change to the following:

    <?php
    /* Woocommerce breadcrumb */
    add_action (‘zerif_after_header’, ‘add_breadcrumbs’, 40);
    function add_breadcrumbs() {
    woocommerce_breadcrumbs();
    }

    Now no product or content display in the woocommerce pages?
    I must be missing something, just not sure what?

    I tested it on Zerif lite before posting. Sight unseen, my best guess is that the code got corrupted during copy/paste. Ensure apostrophies are vertical, not smart/angled, and that the less than sign is that and not the html safe equivalent.
    Try copy and paste again directly from the code block in my earlier post.

    Thread Starter eagleview

    (@eagleview)

    mmm …. I copied and pasted direct from your code block … the same outcome no product or content display in the woocommerce pages).

    Could it be an issue with the “My Custom Functions” plugin?

    I don’t think that’s likely. That’s what I used for my test.

    I presume this is your site:
    https://www.storeit4less.co.nz
    Its showing you have Zerif Lite v 2.0.5 and that’s what I’ve tested with.

    Copy your snippet here:
    https://phpcodechecker.com/
    and “Analyse”. You should get a “no issues found” message. If not, the service will tell you if any dodgy characters have crept in during copy/paste.

    The other test you could do is to temporarily deactivate all plugins except WooCommerce and test. This will show whether the crash is caused by a conflict with another plugin you have.

    If its still not working, put this in wp-config.php. It might be there already, if so change false to true. See if any errors show up.
    define('WP_DEBUG', true);

    Thread Starter eagleview

    (@eagleview)

    mmm …

    [1] Yes, the site is storeit4less.co.nz

    [2] I copied the snippet code to https://phpcodechecker.com/ – I got the ‘no issues found’ message

    [3] I disabled all of plugins, except for the woocommerce plugin and the ‘my custom functions’ plugin with the snippett code added, and tested – the woocommerce pages remained blank at the front end

    [4] In wp-config.php the define(‘WP_DEBUG’, true); was already installed. I have changed the ‘false’ to ‘true’ – I have not as yet received any error messages

    ….. where to from here?

    Thread Starter eagleview

    (@eagleview)

    Hi Lorro,

    Would you please have any other thoughts about what I could try to get a woocommerce breadcrumb to display on the website in the woocommerce pages?

    • This reply was modified 7 years, 6 months ago by eagleview.

    Sorry, its woocommerce_breadcrumb (singular) not woocommerce_breadcrumbs. I thought I’d copied from what worked. So:

    <?php    
      add_action ('zerif_after_header', 'add_breadcrumbs', 40);
      function add_breadcrumbs() {
        woocommerce_breadcrumb();
      }
    
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘breadcrumb’ is closed to new replies.