Forums Forums Search & Filter Pro How to show cats title in search result?

Viewing 5 posts - 11 through 15 (of 15 total)
  • Ross Moderator
    #13803

    It sounds fine, if its not working then I’d double check whether your ID is definitely correct.

    This is how I have my results.php setup and was working fine:

    https://www.designsandcode.com/wp-content/uploads/2015/03/results.zip

    Although this was just for testing, I think the function should go in functions.php of your theme.

    *EDIT* – after thought – if we are loading results via wp-admin/admin-ajax.php – then maybe this doesn’t load your theme, and therefor not the function either – I’m not sure on this haven’t had time to test.

    Either way, I’ll be integrating some functions in to the plugin at some point that will handle all this automatically.

    Thanks

    Anonymous
    #17611

    I am also having trouble with this. I tried <?php echo esc_html($wp_query->query[‘s’]); ?> but I am not sure how to check if [‘s’] is set, or how to set it if it isn’t?

    I am not using ajax, and I am using the archive method. Any ideas?

    Ross Moderator
    #17701

    Hey Jessie can you open a new ticket and explain in a little more detail what your setup is what you’ve tried to do?

    Thanks

    Anonymous
    #23657

    Hi Ross,

    I have your sample code working, which is displaying the category title, how might I display the category description?

    Kind regards,
    Adam

    Ross Moderator
    #23665

    Hey Adam, this is now just standard WP template stuff:

    https://codex.wordpress.org/Function_Reference/category_description

    If you need the ID you can use the slug to grab the category ID:

    https://codex.wordpress.org/Function_Reference/get_category_by_slug

    I think the description might even be returned in the object from this second link so you might not need the category_description function at all

Viewing 5 posts - 11 through 15 (of 15 total)