Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Read-More-Button / Category in results
- This topic has 9 replies, 2 voices, and was last updated 6 years, 4 months ago by
Ernest Marcinko.
-
AuthorPosts
-
January 20, 2020 at 9:34 am #25349
TR-Design09
ParticipantHi,
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
January 20, 2020 at 6:53 pm #25356Ernest Marcinko
KeymasterHi 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:
[<p style='color: #ef8f30'>{__tax_category}</p>] {descriptionfield} <p><a href='{__url}' style='color: #ef8f30'>-> Read more</a></p>January 21, 2020 at 4:38 pm #25372TR-Design09
ParticipantHi 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 #25373Ernest Marcinko
KeymasterHi,
Use the argument without the underscode, so not ‘_date_format’ but ‘date_format’. Such as:
{my_date_field date_format="d.m.y"}January 21, 2020 at 4:57 pm #25374TR-Design09
ParticipantOkay, 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 #25375TR-Design09
ParticipantOk, 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 6 years, 4 months ago by
TR-Design09.
January 21, 2020 at 5:38 pm #25377TR-Design09
ParticipantOr maybe i didn’t. What is the field-name for the post-date…
January 21, 2020 at 6:02 pm #25378Ernest Marcinko
KeymasterOkay, 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!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; }January 22, 2020 at 9:16 am #25389TR-Design09
ParticipantPerfect. Mission accomplished! Thank you so much for your help!
January 22, 2020 at 11:23 am #25392Ernest Marcinko
KeymasterYou cannot access this content.
-
This reply was modified 6 years, 4 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.