Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1319998

    Hi there,

    I am currently using relevanssi with the following solution: https://www.relevanssi.com/knowledge-base/indexing-taxonomy-pages/ to return search results for taxonomy terms (Product Categories and Brands).

    It works fine on the Enfold search results page. But on the Ajax search, the title and link come back blank. Only the excerpt is displayed. I understand the default enfold search is based on posts only.

    But is there a way for me to customize this in my child theme to add results for taxonomy terms in the Ajax search results as well? I was looking as the following thread to try to achieve this: https://kriesi.at/support/topic/ajax-search/ but I’ve not been able to get very far.

    #1320331

    Hey Rustum,

    Thank you for the inquiry.

    Did you use the filter from the following documentation?

    // https://kriesi.at/documentation/enfold/search/#use-relevanssi-in-search-instead-of-the-default-search

    This should return the Relevanssi function instead of the default get_posts function, which is limited to default posts and custom post types.

    Best regards,
    Ismael

    #1320369

    Hi Ismael,

    I have now added the above filter as per: https://kriesi.at/documentation/enfold/search/#use-relevanssi-in-search-instead-of-the-default-search and it still doesn’t fix the issue. Please note that the instruction in the above link also states “The below code is no longer required to add the Relevanssi support to your enfold theme. Please remove from your functions.php file if you have added it to the earlier version of the enfold theme.”

    However, I have left the code in as per your suggestion. The issue is with the Ajax search itself. If you search for the Product Category “Brackets” for example, the Ajax search only returns the excerpt, the title and link are blank. But when you click through to search page: https://orthoemporium.zerobox.co.za/?s=brackets the title and link work as expected. So I just need to get the Title and link to be fixed in the Ajax search.

    Thanks.

    #1320604

    Hi,

    Thank you for the inquiry.

    The title is not displaying because by default the AJAX search is using the get_the_title function, which can only retrieve post title as the name suggests. You will have to modify the functions-enfold.php file and adjust this code around line 433 and 443 in order to get the title and link of the archive pages.

    433:

    $link = apply_filters( 'av_custom_url', get_permalink( $post->ID ), $post );
    

    443:

    $output .= '<span class="av_ajax_search_content">';
    				$output .=		'<span class="av_ajax_search_title">';
    				$output .=			get_the_title($post->ID);
    				$output .=		'</span>';
    

    You may need to use these functions.

    // https://developer.wordpress.org/reference/functions/get_post_type_archive_link/
    // https://developer.wordpress.org/reference/functions/get_the_archive_title/

    Best regards,
    Ismael

    #1320656

    Thanks once again Ismael,
    Is it possible to make this change in my child theme’s functions.php file? if not, I will rather just disable the Ajax search as a workaround for this.

    #1321336

    Hi,

    You can copy the whole avia_ajax_search function in the child theme’s functions.php file, without the function_exists check. This should override original function in the parent theme.

    Thank you for your patience.

    Best regards,
    Ismael

    #1321642

    Thanks Ismael,

    All good now. Works perfectly.

    #1321714

    Hi,

    No problem. Glad we could help. We will close the thread now. Please do not hesitate to open another if you need anything else.

    Have a nice day.

    Best regards,
    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Edit default Ajax search for Taxonomy Terms’ is closed to new replies.