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

 
Keymaster
2 years ago.

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

    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

    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

    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

    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

    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

    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 2 years ago by  TR-Design09.
    #25377

    Participant

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

    #25378

    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

    Participant

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

    #25392
    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.