Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

janaeniell@gmail.com on "Woocommerce Single Product Page Variable Title"

$
0
0

I'm currently trying to write a php variable into the Single Product page of my Woocommerce store template. My husband has a storefront located here: http://jamminjdcards.com/blog/shop/ Under the 'Box Breaks' drop down in the navigation you'll notice both 'Box Breaks' and 'Pack Breaks'. The 'Box Breaks' takes you to the main shop page with all products. The 'Pack Breaks' takes you to a category named 'pack-breaks-shop' and I have code written in my functions.php file to omit all Pack Breaks from the main shop page so they remain separate. One last thing is I have sub-categories established: pack-breaks-football and pack-breaks-basketball nested under the pack-breaks-shop category. All Pack Break products will be applied to both the pack-breaks-shop and applicable sub-category.

All of this has worked superbly - however I remembered that regardless of Category, all products use the same Single Product page template. Right now the title reads "Box Breaks" for all Single Products. Now that I'm adding Pack Breaks though, that title doesn't apply. What I'm trying to do is write a variable php if statement that basically states if we're in the pack-breaks-shop category, to echo x title, else echo x title - so that all other pages will say "Box Breaks".

I hope I've explained that clearly. Let me know if I need to clarify.

Right now I don't have any Pack Breaks up - we haven't launched them yet, so you can't view it on my live server - only on my localhost. However, at this point I mainly just need someone to look at my code and tell me what I'm doing wrong. I'm new to php, so please take a look here:

http://pastebin.com/W8ePubjW

Currently I have this in my title div - which you can see on the live server. As far as templates go, I have this pasted in the product-image.php template found in woocommerce > single-product > add-to-cart > product-image.php.

As of right now I'm implemented this code on my localhost and it has no effect - the title still shows up, but only as "Box Breaks". It doesn't change on any category to "Pack Breaks".

Please let me know if you need additional information. Thank you!


Viewing all articles
Browse latest Browse all 8245

Trending Articles