Customising the Results Page – Portfolio Category names

Forums › Forums › Search & Filter Pro › Customising the Results Page – Portfolio Category names

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #29815

    Hello,

    I purchased this plugin to search and filter some portfolio categories from the Portfolio of the Enfold theme.

    I am trying to make some really basic changes to the results page. For example I would like to display all the categories that a single portfolio item belongs.

    How do I get the category names and display them next to the portfolio item thumbnail ?

    Thank you in advance for your help and support

    Alex

    Ross Moderator
    #29842

    Hey Alex

    So to customise your results you need to figure out which display method you are using and follow the correct link on this page:

    http://www.designsandcode.com/documentation/search-filter-pro/search-results/#Display_Results_Method

    Then once you know how to make modification to your template file, to get the terms associated with the post you want to do something like:

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

    Portofio categories are just Custom Taxonomies.

    Thanks

    Anonymous
    #29844
    This reply has been marked as private.
    Ross Moderator
    #29957

    Hi Alex

    This is the link I just mentioned.

    So inside your template file, next to the thumbnail, you must add the following code:

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

    This will work for any Taxonomy (as mentioned above, portfolio categories are actually a Taxonomy).

    So, you will need to find the internal taxonomy name of “Portfolio Categories” – this will probably be something like portfolio_categories

    If this is the case, then you would probably need something like the following (adapted from teh link above):

    //Do something if a specific array value exists within a post
    $term_list = wp_get_post_terms(get_the_ID(), 'portfolio_categories', array("fields" => "all"));
    
    foreach($term_list as $term_single) {
        echo $term_single->name; //do something here
    }

    This should give you a start 🙂

    Thanks

Viewing 4 posts – 1 through 4 (of 4 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.