-
AuthorPosts
-
January 20, 2025 at 8:23 pm #1475450
Dear Kriesi,
Can I display the portfolio categories for each portfolio item in the Portfolio Grid? I would like to display the different types of project i.e Seminar, Publication, Film etc between each thumbnail and title?
Please see my page in private link below.
Thanks and best wishes,
Richard WildingJanuary 21, 2025 at 3:14 am #1475461Hey Richard,
Thank you for the inquiry.
You can add this code to the functions.php file:
function avf_portfolio_extra_mod($output, $entry) { if (!is_object($entry) || !isset($entry->ID)) { return $output; } $term_list = get_the_term_list( $entry->ID, 'portfolio_entries', '<div class="portfolio-term">', ', ', '</div>' ); if (!is_wp_error($term_list) && !empty($term_list)) { return $output . $term_list; } return $output; } add_filter('avf_portfolio_extra', 'avf_portfolio_extra_mod', 10, 2);
Let us know the result.
Best regards,
IsmaelJanuary 21, 2025 at 11:09 am #1475491Thanks Ismael,
This is great, but they appear above the thumbnails. How can I have them display below the thumbnail above the post title?
I’d also like them to align left, not centred?
Thank you!
January 22, 2025 at 6:22 am #1475530Hi,
Thank you for the update.
You can add this script to insert the category container before the title:
function ava_custom_script_insert_grid_term() { ?> <script type="text/javascript"> (function ($) { $(document).ready(function () { $('.grid-entry').each(function () { var grid_entry = $(this); var grid_portfolio_term = grid_entry.find('.portfolio-term'); var entry_content_header = grid_entry.find('.entry-content-header'); if (grid_portfolio_term.length && entry_content_header.length) { grid_portfolio_term.insertBefore(entry_content_header); } }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'ava_custom_script_insert_grid_term', 9999);
Best regards,
IsmaelJanuary 22, 2025 at 3:50 pm #1475561Great, thanks Ismael.
This works perfectlyJanuary 22, 2025 at 5:33 pm #1475586Hi,
Thanks for the update, we’ll close this thread for now then. Please open a new thread and include WordPress admin login details in private, so that we can have a closer look at your site.
Best regards,
Rikard -
AuthorPosts
- The topic ‘Display portfolio categories’ is closed to new replies.