• Resolved mstudioIL

    (@mstudioil)


    For other site I working on the client what to show other info when hovering the image,
    they don’t want to show the name and category, they want to show the tag of the post, there will one tag.
    How to show tag instead of name and category?
    and not link it?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author livemesh

    (@livemesh)

    The best way is to customize the output with the help of WP hooks and filters provided by the plugin. Is this the free version or the paid one? The hook will depend on which version you have installed on the site. Assuming free version of posts grid, you can take a look at the below snippet that can be inserted into your child theme functions.php file (untested – let me know if you see any error) –

    add_filter('lae_posts_grid_image_info', 'mytheme_posts_grid_image_info', 10, 3);
    
    function mytheme_posts_grid_image_info( $image_info, $post_id, $settings) {
    
        $image_info = '<div class="lae-image-info">';
    
        $image_info .= '<div class="lae-entry-info">';
        
        $image_info .= lae_get_info_for_taxonomies(array('post_tag'));
    
        $image_info .= '</div>';
    
        $image_info .= '</div><!-- .lae-image-info -->';
    
        return $image_info;
    }

    More such customization examples can be found here –

    https://gist.github.com/live-mesh/90a79048686651fa0bfbf0eb40493611

    Plugin Author livemesh

    (@livemesh)

    Since you do not need the link, the right code probably is –

    add_filter('lae_posts_grid_image_info', 'mytheme_posts_grid_image_info', 10, 3);
    
    function mytheme_posts_grid_image_info( $image_info, $post_id, $settings) {
    
        $image_info = '<div class="lae-image-info">';
    
        $image_info .= '<div class="lae-entry-info">';
    
        $terms = get_the_terms($post_id, 'post_tag');
    
        if (!empty($terms) && !is_wp_error($terms)) {
    
            $image_info .= '<span class="lae-terms">';
    
            $term_count = 0;
    
            foreach ($terms as $term) {
    
                if ($term_count != 0)
                    $image_info .= ', ';
    
                $image_info .= $term->name;
    
                $term_count = $term_count + 1;
            }
    
            $image_info .= '</span>';
        }
    
        $image_info .= '</div>';
    
        $image_info .= '</div><!-- .lae-image-info -->';
    
        return $image_info;
    }
    Thread Starter mstudioIL

    (@mstudioil)

    Thanks, I don’t need link and using the free version,
    So the second version is the right?

    Plugin Author livemesh

    (@livemesh)

    Yes, the second one is the right one. Pls give a try and let me know if you need further help.

    Thread Starter mstudioIL

    (@mstudioil)

    Thanks, how this removing the name and category?

    The above code- second version- will remove the post title and category that displays on hover.
    Can you pls try that ?

    Thread Starter mstudioIL

    (@mstudioil)

    Thanks, it working great

    Thread Starter mstudioIL

    (@mstudioil)

    It works great, can I change from the tags to the excerpt,
    I think it will work better, I using WPML and the tags change every time I update the post

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Post grid hover info’ is closed to new replies.