Display Post Views & CPT Count with Crocoblock Jetengine | Elementor | WordPress

preview_player
Показать описание
You might have face problem displaying Post Views for the CPT especially if your website is a newspaper, property listing or classified. In this tutorial, i will show you how to create it with few lines of code in JetEngine Crocoblock.

In addition to that it covers how to show total number of CPT.

Code to be inserted in Child theme:
$meta_values = get_post_meta( get_the_ID(), "posts-count", true);
$v2 = (int)$meta_values + 1;
update_post_meta( get_the_ID(), 'posts-count', $v2);

Download Elementor:

Download Crocoblock:

Need to build dynamic websites?

Follow me on Social Media

Track: Peruvian Woods — Dave Osorio [Audio Library Release]
Music provided by Audio Library Plus
Watch: • Peruvian Woods — Dave Osorio | Free B...
Рекомендации по теме
Комментарии
Автор

Finding your channel made my day. I have been looking hard for someone who explains JetEngine more clearly than the docs on their website. I have been using Crocoblock for the past 4 years but I've only scratched the surface of what is possible I'm sure. That you are explaining some PHP code that interacts with it as well is also a big help. Thanks Liked! Subscribed!

brink
Автор

Excellent video!!
I don't know what I'm doing wrong but you wouldn't be telling me..
I have put the code from the plugins code snippet

$meta_values = get_post_meta( get_the_ID(), "counter-properties", true);
$v2 = (int)$meta_values +1;
update_post_meta( get_the_ID(), "counter-properties", $v2);

Thanks for your time!!

mauricioalejandro
Автор

Your channel and content!! Thank you for sharing this, you don't understand how beneficial it has been! Blessings to you.

isaacosei
Автор

Hola, , que excelente video, , te agradezco por compartir tu conocimiento, , gracias y sigue adelante, , te encontré por casualidad y no sabes el gusto que me da, , nuevamente gracias y por favor, sigue haciendo este tipo de videos que son diferentes a los que se encuentran en YouTube

juan
Автор

Thanks Abdul Moxet, that's an amazing video. Looking forward to seeing the full video of how you built the all site.

naabigaabdoulrazak
Автор

Moxet Khan, you are
thanks for such good content...
Please make videos as soon as possible....

MuhammadBilal-ocpi
Автор

This is great information! I was already tracking this data from Google Analytics, but it can be attractive for high hit content for advertisers to access this data on my website :) Thank you

toygarniron
Автор

Great, I hope you continue to develop content about Jetengine

WOWACC
Автор

I'd like to add that for each post of a logged user. For example: a user visits a post and I want to tell him: "You've seen this post 4 times". It's for a college content review post type...

acarolalvarenga
Автор

Anyone who faces a problem due to a recent update, please encapsulate your code in a filter as below

function increment_post_views() {
if (is_single()) {
$post_id = get_the_ID();
$views = get_post_meta($post_id, 'post-count', true);

// If the 'post_views' meta field doesn't exist, initialize it to 1
if (empty($views)) {
$views = 1;
} else {
$views = intval($views) + 1;
}

// Update the 'post_views' meta field with the incremented value
update_post_meta($post_id, 'post-count', $views);
}
}

add_action('wp', 'increment_post_views');

MoxetKhanPK
Автор

First of all thank you for this video
But there are two problems when I use this code
function view_counter($content) {
$meta_values = get_post_meta( get_the_ID(), "post-count", true);
$v2 = (int)$meta_values + 1;
update_post_meta( get_the_ID(), 'post-count', $v2);

}
add_filter('the_content', 'view_counter');
First one is the pages content disappeared.
I solved this by adding this line
return $content ;
The Second problem that the code works on edit post type page but doesn't work on a single page
The single page that I use is Crocoblock > Theme Builder > Single page
If any help I will be appreciate thanks

mohamedalarabe
Автор

Works great, thanks;
does not work with caching plugin, possible to do the same thing in AJAX or JS? Thanks

michaelj.
Автор

Thank you for the video. Yes I would love to see how you build the whole system from scratch. Sometimes to better understand some features, you have to explain what environment you are using it for. Waiting for the tutorial as you promised. Thank you again. This is awesome. But the way why didn't you just use the CPT or post count from Jetengine without using the codes in the child theme?

serdimay
Автор

Hello, is there a way to trigger the counter with a time delay, so that it is prevented that a visitor drives the counter up by constantly loading the page. Example: The page is updated several times in one minute but the counter only counts up every minute or every 2 minutes.

werbeagenturpr-pro
Автор

Excellent!! Thanks for sharing your knowledge!
Query:

*Is it possible to make a listing impression counter?

mauricioalejandro
Автор

Hello muqsit, how can I make only signle views for single user. 1 view = 1 user. I think this is done via user meta query.

soyeb_ali
Автор

Hello, you are amazing.
by the way, do you know how to add numbers (numbering) to the posts yo my listing grid? and could you tell me how please?

for example, in my Listing, I want it looks like this:

Number 1*, Title Post, then the descriptions
Number 2*, Title Post, then the descriptions
Number 3*, Title Post, then the descriptions
etc...

* the numbers mean, it's automatically added, and ascending by date or name. according to the number of posts that appear on the page/archive.

thank you.

SixGamerHeads
Автор

Thank you so much for solution. You have solution for display post view for CCT?

luldlfc
Автор

This was Brilliant. I am looking for the code of displaying the number of times a document (PDF) has been downloaded to be displayed on the front end

rodneylivanze
Автор

Its an amazing video tutorial.. Please make a video how to build user profile ( Dashboard / login / sign up) by Crocoblock

seekknowledge