I'm trying to filter the shop title and wrap it with a span for styling
this doesn't seem to work
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.
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'
Please read my updated comment.
thanks for trying to help out and sorry for the "it doesn't work" :)
actually it outputs this
Are you sure you don't have other filters causing that? Because the code you provided alone, will work, I just tested it.
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
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.
Also try removing your priority...So remove the "15" from the add_action.
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 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.
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!
You must log in to post.