Read-More-Button / Category in results

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 Ernest Marcinko 4 years, 3 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #25349
    TR-Design09
    TR-Design09
    Participant

    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.
    #25356
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi 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>
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #25372
    TR-Design09
    TR-Design09
    Participant

    Hi 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.

    #25373
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Use the argument without the underscode, so not ‘_date_format’ but ‘date_format’. Such as:

    {my_date_field date_format="d.m.y"}

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #25374
    TR-Design09
    TR-Design09
    Participant

    Okay, but what is my “my_date_field”. If i use {__date} i get the date, but in a wrong format, which is noch editable.

    #25375
    TR-Design09
    TR-Design09
    Participant

    Ok, 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 4 years, 3 months ago by TR-Design09 TR-Design09.
    #25377
    TR-Design09
    TR-Design09
    Participant

    Or maybe i didn’t. What is the field-name for the post-date…

    #25378
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay, 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;
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #25389
    TR-Design09
    TR-Design09
    Participant

    Perfect. Mission accomplished! Thank you so much for your help!

    #25392
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.