Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Read-More-Button / Category in results
This topic contains 9 replies, has 2 voices, and was last updated by Ernest Marcinko 3 years, 4 months ago.
- AuthorPosts
- January 20, 2020 at 9:34 am #25349
Hi,
is there a way to have a read more-button shown in the results right under the description?
And is it somehow possible, to show the category of a post in the results next to the date?
It should look like the screenshot!
Thanx in advance.
Michael / TR-Design
Attachments:
You must be logged in to view attached files.January 20, 2020 at 6:53 pm #25356Hi Michael,
Well, you can use the advanced title and content fields for that. It allows listing the post categories as well as a custom HTML in the content. The exact same layout might not be possible, but something similar surely.
You could try something like this:
Best,[<p style='color: #ef8f30'>{__tax_category}</p>] {descriptionfield} <p><a href='{__url}' style='color: #ef8f30'>-> Read more</a></p>
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 21, 2020 at 4:38 pm #25372Hi Enest,
that helped a lot. When i use {__date} to place the date in the results, how can i change the format? _date_format=”d.m.y”} does not seem to work.
Thanks for your help.
January 21, 2020 at 4:47 pm #25373Hi,
Use the argument without the underscode, so not ‘_date_format’ but ‘date_format’. Such as:
Best,{my_date_field date_format="d.m.y"}
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 21, 2020 at 4:57 pm #25374Okay, but what is my “my_date_field”. If i use {__date} i get the date, but in a wrong format, which is noch editable.
January 21, 2020 at 5:00 pm #25375Ok, i think I’ve found it.
EDIT: Or maybe i didn’t. What is the field-name for the post-date…
-
This reply was modified 3 years, 4 months ago by
TR-Design09.
January 21, 2020 at 5:38 pm #25377Or maybe i didn’t. What is the field-name for the post-date…
January 21, 2020 at 6:02 pm #25378Okay, I see the issue now. The post date field is not affected by those arguments, that might require a custom code. The post date field is __date, but the date format will do nothing there, it is for custom fields.
Instead of the variables in brackets, try using this string within the custom content field to mark the date:
||date||
Then a custom code will find, and process it.
Please try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
Best,add_filter('asp_results', 'asp_filter_custom_date', 10, 1); function asp_filter_custom_date( $results ) { foreach ( $results as $k => &$r ) { $date = date_i18n("d.m.y", strtotime($r->date)); $r->content = str_replace('||date||', $date, $r->content); } return $results; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 22, 2020 at 9:16 am #25389Perfect. Mission accomplished! Thank you so much for your help!
January 22, 2020 at 11:23 am #25392You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
-
This reply was modified 3 years, 4 months ago by
- AuthorPosts
You must be logged in to reply to this topic.