WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
wrap shop title with span (12 posts)

  1. Paul de Wouters
    Human Made
    Posted 1 year ago #

    Hi

    I'm trying to filter the shop title and wrap it with a span for styling
    <h1><span>Shop</span></h1>

    this doesn't seem to work
    http://pastebin.com/hcXvzPfS

    any suggestions?
    thanks

    http://wordpress.org/extend/plugins/woocommerce/

  2. Roy Ho
    Member
    Posted 1 year 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 1 year 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
    http://vli.wpengine.com/contact/

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

  4. Roy Ho
    Member
    Posted 1 year ago #

    Please read my updated comment.

  5. Paul de Wouters
    Human Made
    Posted 1 year ago #

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

    <h1><sppan></span></h1>
    <h1>Shop</h1>
  6. Roy Ho
    Member
    Posted 1 year 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 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

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

  10. Paul de Wouters
    Human Made
    Posted 1 year 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
    Member
    Posted 1 year 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 1 year 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

About this Topic

Tags

No tags yet.