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)