![]() |
How do I make unique title tags for price filter widget pages?
(I am using the filter by price widget in this question.)
I see that once I click on a filter by price link, the same category title is used in the price filter. I am wondering if there is a way to create a unique title based on the price as well as the current category. This is a good example. They use the category name but also get under $50 into the title. Store ID 6719 www.forbabygifts.com |
This works for me in the <head> elements:
PHP Code:
|
In the filter by price widget head elements? I tried it there and do not see changes.
Any ideas? |
No, in the CATEGORY PAGE > Default > View menu > View <head> Elements section.
|
I have views created for my category pages. (I did try it in default but no dice).
I did it in one of my views, but when I added the price widget, my left navigation disappeared. You can see it here This is what I added to the <head> elements of that view <?php function format_price($price) { $price = strip_tags($price); $price = explode("-", $price); if (trim($price[0]) == '') $html = 'less than $'.$price[1]; elseif (trim($price[1]) == '') $html = 'more than $'.$price[0]; else $html = '$'.$price[0] . ' - '. '$'.$price[1]; return $html; } ?> <title>Christening Rosaries | Christening Rosary Gift Ideas | [store.if page="on"] | page [store.page] | [/store.if]<?php if (@$_GET['price']) { ?> Price is <?php echo format_price($_GET['price']); ?> | <?php } ?> </title> |
I inserted your exact code into my test site and it worked fine.
You can see that it does work here where you have added the code to the <head> element. Regarding your sidebar disappearing, are you sure it's related to the <head> code? Could it be something in your widget settings? Eric |
I think it is due to my widget settings. And your example looks great! That is exactly what I wanted.
|
But this is weird. If I use the tag cloud setting, my left nav stays with the tag cloud. When I switch it to price filter, my left navigation disappears.
|
Are you clicking "Save" when you make an edit to the widgets on the WP widgets page?
|
Yes, and after I refresh the page, it vanishes.
|
Are you using some type of widget context filter plugin?
|
I am using the Widget Context plugin. And I have it set to Show on Selected and store/category* assigned to it.
|
What happens if you remove the extra <title> stuff that we did? Does the widget come back?
|
Yes, it does.
|
Maybe try renaming the function call from format_price to forbabygifts_format_price. Maybe it's conflicting with another function.
PHP Code:
|
Tah-Da!!!!! .....and Thank you!!
Now, one last question, if I also want to do this with filter by merchant widget, is there a code for that as well? |
All times are GMT -5. The time now is 03:58 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.