Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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 Wilding

    #1475461

    Hey 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,
    Ismael

    #1475491

    Thanks 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!

    #1475530

    Hi,

    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,
    Ismael

    #1475561

    Great, thanks Ismael.
    This works perfectly

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.