The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

wrap shop title with span (12 posts)

  1. Paul de Wouters
    Human Made
    Posted 3 years ago #


    I'm trying to filter the shop title and wrap it with a span for styling

    this doesn't seem to work

    any suggestions?


  2. Roy Ho
    Posted 3 years ago #

    May I ask what styling you're trying to add?

    Also you said "it doesn't seem to work". Can you be more specific? Area you meaning it filters it but in the wrong location in terms of pages or are you saying it is not filtering at all?

    Because according to your code, it should work.

    However I would change this line to be more flexible:

    return '<span>' . $page_title . '</span>';

    So you're not hardcoding the "Shop" text in there.

  3. Paul de Wouters
    Human Made
    Posted 3 years ago #

    yeah, it's a background color on the span so the horizontal line doesn't show through.
    here's a page where it works

    by the way, woocommerce should make sure WordPress native filters still work like 'the_title'

  4. Roy Ho
    Posted 3 years ago #

    Please read my updated comment.

  5. Paul de Wouters
    Human Made
    Posted 3 years ago #

    thanks for trying to help out and sorry for the "it doesn't work" :)
    actually it outputs this

  6. Roy Ho
    Posted 3 years ago #

    Are you sure you don't have other filters causing that? Because the code you provided alone, will work, I just tested it.

  7. Paul de Wouters
    Human Made
    Posted 3 years ago #

    interesting. I just switched to twenty twelve and disabled all other plugins and put the filter in functions.php but no luck.
    also, I set a breakpoint inside the callback but it's not stopping so for some reason the filter isn't being called

  8. Roy Ho
    Posted 3 years ago #

    Well take note of your conditional inside. Are you on a product archive page? How about removing that conditional for a test and see if it works.

  9. Roy Ho
    Posted 3 years ago #

    Also try removing your priority...So remove the "15" from the add_action.

  10. Paul de Wouters
    Human Made
    Posted 3 years ago #

    so, this is a genesis child theme. I now installed the genesis connect templates in the child theme, and noticed that the title actually does use
    apply_filters('the_title'... but it's missing the $id argument
    look at line 254 of template-loader.php, there should be an $id parameter.
    So now I have to have a different callback for the woocommerce pages.
    I still don't know how to apply the filter to only the main title on the page instead of all the nav menu items and the product titles on the shop page
    this is getting much more involved that I expected.
    I wish there was an easy CSS solution. Or maybe I'll use javascript

  11. Roy Ho
    Posted 3 years ago #

    I am not familiar with Genesis so I don't know how they have setup their filters but regardless of that, the filter you're using in the code you provided is already specific to WC so it shouldn't affect your menu items.

    The test I did which works fine was on the default 2012 theme.

  12. Paul de Wouters
    Human Made
    Posted 3 years ago #

    ok, so turns out the Genesis Connect plugin templates are in need of an update for Woocommerce 2.0
    I managed to update them on my install and it seems to be ok for now. I'll do some more testing and report back, in case someone else has the same issue
    thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.