This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Read-More-Button / Category in results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Read-More-Button / Category in results

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #25349
    TR-Design09TR-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

    #25356
    Ernest MarcinkoErnest 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>
    #25372
    TR-Design09TR-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 MarcinkoErnest 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"}

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

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

    #25378
    Ernest MarcinkoErnest 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;
    }
    #25389
    TR-Design09TR-Design09
    Participant

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

    #25392
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.