No styling dynamic page title on Woocommerce pages

Hello Themeco,

I’ve made a website with a Woocommerce shop with the new Layout pages and Looper functions. Works really great, love it! Now I want to show the page or category title above the shop pages but when I add the dynamic content {{dc:woocommerce:page_title}}the styling of the headline disappears.

Below an image of the main shop page with the dynamic page title.

!

And below i changed the dynamic page title code to plain text “Shop”.

Do you know what the problem is?

Howdy, @Timmid! Thanks for writing in…I recreated this setup locally and found the same result. After digging into it a bit, I found that our {{dc:woocommerce:page_title}} string which returns woocommerce_page_title() behind the scenes was set to its default, which is to echo its result rather than return it, which is what is causing the styling to be ignored.

I have updated this in the source code and it is now working on my local installation as expected, sorry for the inconvenience there! Our next main release should be going out sometime around early March, unless we have some sort of mission critical error that requires a hotfix. This fix will be available in that next release, but until then I would recommend hard-coding a value that will work for now until this fix gets released. If you need some variable output, you could clone your headline multiple times and have different hardcoded values for your “Shop,” “Cart,” “Checkout,” et cetera, and display only the ones you want on certain pages using Element conditions like so…

Of course these are only a few examples, we have Element Conditions for all other WooCommerce contexts like account pages, various product types, et cetera. This will at least tie you over until that main release is put out. If you have not dug into Element Conditions yet and would like to learn more, we have an in-depth article about them on our Docs:

Additionally, we have a helpful video resource on using more advanced “expressions” with Element Conditions if you’d like to look into that as well:



Cheers!

Thx for the reply @kory.

I think I will wait for the next release because we have a lot of categories and making it work with your suggested work around will be a lot of work, and finally I would like to have it working as I have now with the right styling of the header.

Thx for now!

Sounds good, @Timmid! Yes, you could also just hardcode a general string that works everywhere for the time being until the release goes out. Sorry again about the error there but thanks for bringing it to our attention so we can address it. Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.