Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Product tag formatting in search results
- This topic has 10 replies, 2 voices, and was last updated 8 years, 3 months ago by
Preet.
-
AuthorPosts
-
February 20, 2018 at 11:55 pm #16865
Preet
ParticipantHi, I am having trouble finding how to format and change the product tag results, especially on mobile.
It seems I can’t get rid of the tag itself, and then the Description is added afterwards and the results panel inherits formatting from the description itself. when I would prefer it was, Just the description, and in a format that matched the rest of the results.
Thanks.
February 21, 2018 at 10:32 am #16869Ernest Marcinko
KeymasterHi!
I have run a few test queries, and I believe you are reffering to these: https://i.imgur.com/BuSI2Hk.png
That should not look like that at all. The source tells, that these are h1 and h3 tags, but those should be stripped by default.If you don’t want the product tag results at all, then you can turn them off here: https://i.imgur.com/8CpBPCs.png
If you need those in the results, then one possible cause of the unstripped tags could be, that they might be allowed. On the Advanced Options -> Content panel, make sure this option is empty: https://i.imgur.com/m0SuOf6.png
This should remove all possible tags, and keep the text only.February 21, 2018 at 12:24 pm #16875Preet
ParticipantHi there,
Yes. That’s the issue. that field contained <abbr><b>, which I deleted and cleared caches. But it didn’t seem to make much difference.
We are very keen to retain the product tags as customers use and like them (they got used to them when we previously used YITH Ajax Search). The formatting difficuty I have is that both the Tag itself and the Description are returned in the results. This causes repetition.
Ideally, I would be able to choose either just the Tag itself, or just the description.
If just the Tag itself, it would be great to have a universal prefix, eg: “Department – Sugar-free” or “Section – Sugar-free” (Same for Product Categories, but we rely on these less)
If just the description, then it would be good to format the title differently from the paragraph text, bearing in mind that the Description would normally be a headline related to the tag, but not exacty the tag, followed by some narrative text about the products in the tag.
Many thanks.
February 21, 2018 at 12:36 pm #16876Ernest Marcinko
KeymasterHi,
That is strange, it should be filtered from tags, I feel like something might be conflicting there, I’m not sure.
You can actually turn off the the term descriptions here, to only display the tag names: https://i.imgur.com/444ayyJ.png
With a custom code, it is possible to place a prefix to the tag results as well. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
Change the $prefix variable to whatever you want the product tags to be prefixed.
February 21, 2018 at 3:28 pm #16877Preet
ParticipantThanks for prefix code. it works well.
But the descriptions don’t want to turn off. H3 looks OK, but H2 is huge. And I’d really prefer to have description OR tag, but not both.
Best,
ChristopherFebruary 21, 2018 at 4:09 pm #16879Ernest Marcinko
KeymasterHi Christopher,
In that case, I believe the best option is to simply style those section as the secription via custom CSS.
Apply this code to your theme custom CSS field (if it supports it) or use the custom CSS field on the search plugin back-end.
[html].asp_content h1, .asp_content h2, .asp_content h3:not(:first-of-type) {
font-family: ‘Open Sans’ !important;
font-size: 13px !important;
font-weight: 400 !important;
line-height: 18px !important;
color: rgb(74,74,74) !important;
}[/html]This will force all h1, h2 and h3 elements within the tag descriptions to appear styled as simple text.
February 21, 2018 at 5:29 pm #16880Preet
ParticipantThat worked! We are definitely getting there. But what I am really trying to do is show either the Tag or the Description, but not both together.
The reason for this is that the template only puts the Description on the archive page, not the Tag. So if I want the Tag as the title in h1 on the archive page, I have to put it in as part of the Description. And if I do that at the moment, I then get two copies if the title.
Many thanks
ChristopherFebruary 22, 2018 at 12:52 pm #16884Ernest Marcinko
KeymasterHi Christopher,
In that case, if I understand correctly, the h1 is actually not needed (as it is the tag name duplicate). If so, then this custom CSS will hide it from the results content:
[html].asp_content h1 {
display: none !important;
}[/html]Keep the previous custom CSS as well, as it will still affect the remaining h2 and h3 elements.
February 22, 2018 at 2:39 pm #16887Preet
ParticipantBrilliant! This makes all the difference. We can now populate all our Product Tag descriptions, for SEO and internal search purposes.
Thank you.
ChristopherFebruary 22, 2018 at 2:40 pm #16888Ernest Marcinko
KeymasterYou cannot access this content.
February 22, 2018 at 2:45 pm #16889Preet
ParticipantI just rated it already.
Thanks again. -
AuthorPosts
- The topic ‘Product tag formatting in search results’ is closed to new replies.