Support » Plugin: Post Grid Elementor Addon » Overlay play icon on post grid

  • Resolved lokide

    (@lokide)


    Hello,

    I was wondering if there is a way of showing in the post grid of elementor in the hopemage an overlay play icon if the article is of video type (like for the video plugin), maybe specifying a tag or a category in which the play icon should always appear.

    Or maybe if you can add such a funcion.

    Thank you and regards,
    lokide

    • This topic was modified 2 months ago by lokide.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author maneshtimilsina

    (@maneshtimilsina)

    Hi @lokide

    There is no option to add a play icon as you said in the current version of plugin. It seems great feature. I will try my best to add this feature in the upcoming version.

    lokide

    (@lokide)

    Since you were so kind to reply here, I want to ask you something.

    I have a news website, so I’ve added a counter for the posts.

    Add this codes from the following block in your themes function.php file. It will configure your theme to enhance this functionality:

    function getPostViews($postID){
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
    return "0 View";
    }
    return $count.' Views';
    }
    function setPostViews($postID) {
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
    $count = 0;
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
    }else{
    $count++;
    update_post_meta($postID, $count_key, $count);
    }
    }
    // Remove issues with prefetching adding extra views
    remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);

    Now add the following line of code in your single.php file within the loop. It will track the views and set the views of each post.

    setPostViews(get_the_ID());

    And then I’ve edited the skin-base.php in a way to show the counter just for logged it users with this code:

    <span class="sobellosofigo">- <?php echo getPostViews(get_the_ID());?></span>

    <style>
    .sobellosofigo {
    display: none;
    }

    .logged-in .sobellosofigo {
    display: inline;
    }
    </style>

    Everything was working perfectly. THEN I found the Theme Builder Single function, and I needed it, so I’ve started using it and now the counter is not working anymore. I suppose because I have no idea now where to add the single.php part of the code for the loop, or well, I’ve tried a few solution, but instead of showing the post counter, it’s showing me for every post the counter for the entire website, if I refreh the homwpage, it will increase by 1 on every posts.

    Any idea? Can you help me somehow? Where is the loop in elementor? The one like the “single.php” of the theme!

    Thank you and regards,
    Stefano.

    lokide

    (@lokide)

    Nevermind, I figure it out! 🙂

    Plugin Author maneshtimilsina

    (@maneshtimilsina)

    Great

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