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

Поделиться
HTML-код
  • Опубликовано: 23 авг 2024
  • 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:
    elementor.com/...
    Download Crocoblock:
    crocoblock.com...
    Need to build dynamic websites?
    softemblems.com
    Follow me on Social Media
    Facebook : / mxtchamkani
    Instagram : / moxet
    Twitter : / sokaniwaal
    Track: Peruvian Woods - Dave Osorio [Audio Library Release]
    Music provided by Audio Library Plus
    Watch: • Peruvian Woods - Dave Osorio | Free B...
    Free Download / Stream: alplus.io/peru...

Комментарии • 153

  • @brink6876
    @brink6876 2 года назад +5

    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!

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад +3

      Thank you for your interest and visting the channel, will try my best to share more valuable tutorials in future :)
      Keep in touch please

  • @isaacosei8299
    @isaacosei8299 5 месяцев назад

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

  • @mauricioalejandro7329
    @mauricioalejandro7329 Год назад +1

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

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад +4

      please encapsulate your code in a filter as below
      add_filter('the_content','view_counter');
      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);
      }

  • @naabigaabdoulrazak1959
    @naabigaabdoulrazak1959 2 года назад

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

  • @mohamedalarabe1330
    @mohamedalarabe1330 Год назад +5

    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

    • @thomasanderson5873
      @thomasanderson5873 5 месяцев назад +1

      same here. doesnt work on a single page/single post.

    • @chris_reyem
      @chris_reyem 5 месяцев назад

      ​@@thomasanderson5873

    • @chris_reyem
      @chris_reyem 5 месяцев назад

      // Erhöhe den Seitenaufrufzähler
      function increment_page_views() {
      $current_views = get_post_meta(get_the_ID(), 'page_views', true);
      if ($current_views == '') {
      $current_views = 0;
      }
      $new_views = $current_views + 1;
      update_post_meta(get_the_ID(), 'page_views', $new_views);
      }
      add_action('template_redirect', 'increment_page_views');

  • @cookie9250
    @cookie9250 2 года назад +1

    Views count worked for me.... Thanks

  • @toygarniron
    @toygarniron 2 года назад +1

    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

  • @juan07241981
    @juan07241981 2 года назад +2

    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 RUclips

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Muchas gracias por tu interés. Por favor, manténgase en contacto para más videos.

  • @MuhammadBilal-oc6pi
    @MuhammadBilal-oc6pi 5 месяцев назад

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

  • @1WOWACC
    @1WOWACC 4 месяца назад

    Great, I hope you continue to develop content about Jetengine

  • @werbeagenturpr-pro5197
    @werbeagenturpr-pro5197 2 года назад +2

    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.

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад +1

      Yes it is possible with the combination of cron job/delay and user agent, so the user agent will get the user details and cronjob will make sure it execute after X time. wordpress.stackexchange.com/questions/56266/delay-function-on-publish

  • @michaelj.9401
    @michaelj.9401 Год назад +1

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

  • @soyeb_ali
    @soyeb_ali Год назад +1

    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.

  • @SixGamerHeads
    @SixGamerHeads 2 года назад +2

    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.

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Hello, you have to use query builder to create a query which fetches all your post details in addition to one extra column for count. I have attached a sample of query builder here.
      prnt.sc/_yWsUzdrQJ13
      Once the query is done, you can display the columns in listing grid including counter column.

  • @mauricioalejandro7329
    @mauricioalejandro7329 Год назад +1

    Excellent!! Thanks for sharing your knowledge!
    Query:
    *Is it possible to make a listing impression counter?

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад +1

      Most probabaly with jquery, the visible part of the canvas should send +1 to the impression meta in the back-end each time someone scroll. Its just an idea not yet implemented.

    • @mauricioalejandro7329
      @mauricioalejandro7329 Год назад

      @@MoxetKhanPK it would be great

  • @user-lu7ld6lf3c
    @user-lu7ld6lf3c Месяц назад

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

  • @MoxetKhanPK
    @MoxetKhanPK  Год назад +3

    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');

    • @alwinlangmann89
      @alwinlangmann89 Год назад

      Hey man really love this! Could you please help me with my Rank?
      I want to be able to view the posts that the most people clicked "submit" on.
      So i got a elementor form with a submit button on my single-post page.
      Everytime someone submits the form on a specific post, its "rank" counter should increase.
      thanks

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад

      @@alwinlangmann89 Hello Alwin, thank you for you interest. Its easy, what you need to do is to have the button connect to an internal hook as notification in the form. When you click on button it should trigger the hook and the hook should have something like this [make sure your hook name is send]
      add_action('jet-engine-booking/send', 'send', 10, 2);
      function send($data, $id){

      $post_id = $data["post_id"];
      $meta_values = get_post_meta($post_id, "rank-meta", true);
      $v2 = (int)$meta_values + 1;
      update_post_meta($post_id, 'rank-meta', updated value);

      }

    • @alwinlangmann89
      @alwinlangmann89 Год назад +1

      @@MoxetKhanPK thank you so much! AWESOME

    • @tkrh.106
      @tkrh.106 Год назад

      Hi, thank you for providing very useful information.
      I post the vimeo URL to show the video in the post. After setting this filtered code , the page cannot load the vimeo. Is there any way to resoleve this??
      And using the past code written in a description , the count function was not working.

    • @KHRifat
      @KHRifat Год назад

      I am looking for something like this, you helped me a lot. I am making a Directory site, where every business can see "How many times their profile is visited" in their Dashboard. Also, how many leads they collected (on the profile page there will be some offers if anyone "Claims" the offer by clicking the button, it will be counted as a lead). How to achieve that.?
      In the dashboard, every user can see their own statistics (Profile visits & Collected leads). Hopefully you will help me with this.

  • @TiagoMBarreto
    @TiagoMBarreto 2 года назад

    Thanks for this video Bro, Congrats!

  • @acarolalvarenga
    @acarolalvarenga Год назад

    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...

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад +1

      Hello, use JetEngine data store for that, it counts for logged in users.

    • @acarolalvarenga
      @acarolalvarenga Год назад

      @@MoxetKhanPK thank you, I'll check that up!

  • @jenniferward6821
    @jenniferward6821 2 года назад +1

    Hi Moxet the guru of Croco. Just asked for a tut about drop downs where in front end firm submission, a SELECT field will then restrict the options in the next select field, eg country, then city then suburb, that sort of thing PLEASE do a tut on that?? Trawled RUclips and found nothing at all.

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад +1

      Hello Jennifer, the issue is discussed like 32 weeks ago and mentioned by crocoblock that it is in pipeline to be released. There is no simple shortcut as of now but doable with jquery
      stackoverflow.com/questions/30346640/javascript-jquery-dependent-drop-down-list

    • @jenniferward6821
      @jenniferward6821 2 года назад

      ☹️ jquery… Perhaps do a tut in this??
      Re the map listings function:
      it seems a crucial thing is for the user to have a default “home” starting point, either from browser or from meta, but also the ability to filter the map, using cities, towns suburbs etc. Perhaps via a CCT with all the geolocations user could reference?
      Then the search for coffee shops mechanics whatever which is already easily done with Jetengine. So three options for that important starter map - 1) the geolocate of the browser - done, 2) the meta of the USER address (switch?) and 3) Heirachical selects of country city suburb .. sort of thing?
      Feels to me all of this is already possible, but my knowledge is to scant. Tut??
      it not possible to use a dynamic range filter on the page to increase / decrease the results one finds? Also if the USER sets up his home suburb, which is geolocated in a CCT, then can we use that as the start place of the map on the page? All sounds (vaguely) doable already?? Please do more on this?

  • @WawanInt
    @WawanInt Год назад +1

    Its so awesome..thanks🙏

  • @Ellinio
    @Ellinio 2 года назад

    Hello there, Great Tutorial!! Many Thanks!! In my case the post counter rises up by 2 instead of 1 view every time i refresh the page. Any Tip how to resolve that? Thanks in advance!! Greatings from Greece!!

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Hello Thank you for your interest, not sure what is wrong exactly but you can install code snippet and insert over there.

  • @rodneylivanze2906
    @rodneylivanze2906 Год назад

    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

  • @serdimay7
    @serdimay7 2 года назад +1

    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?

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад +2

      I will surely share the full case study soon, do we have built post views built in jetengine?

    • @jayveecabug6684
      @jayveecabug6684 2 года назад

      @@MoxetKhanPK waiting you build the whole system from scratch

  • @webstep4677
    @webstep4677 2 года назад +1

    thanks the code works, but my problem is that the counter is updated 2 times.
    Example:
    count_start = 116
    count_end = 117
    If at this moment you look at the value in the admin panel, then there will be 118.
    I will be glad if someone can help me to solve the problem

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад +1

      Hi, need to check it thoroughly.
      Please contact via email.

  • @anumnetwork
    @anumnetwork Год назад

    Nice Sir ... Thank You

  • @jernias637
    @jernias637 2 месяца назад

    Hey Abdul Moxet. Thank you for the great video, love your contents. I have a question; is it possible to do it for custom content types? I created a messaging system similiar to whatsapp by your videos. Basically, I created a post for chat and cct for messages. I want to inform users for not read messages.

  • @dariondanielscreative
    @dariondanielscreative 2 года назад +1

    Hi Moxet! Thank you for great video. What would be the code if I wanted to exclude admin views?

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Please check this link
      developer.wordpress.org/reference/functions/is_admin/

  • @mrshesek
    @mrshesek Год назад +1

    Hello and thank you for this amazing video!
    IS there a way to implement this for button click tracking? I have a CPT called Therapists, and contact buttons (Call, Facebook, Mail etc), and the client wishes to count the clicks on this buttons individually for every therapist.
    Is that possible?

  • @ProkomputerRup
    @ProkomputerRup Год назад +1

    Thanks for receipe. How about caching plugin? Will be This works?

  • @brusbezerra
    @brusbezerra 8 месяцев назад

    Great tutorial, thanks! What about if we want to count viewers by session, not unique views?

    • @MoxetKhanPK
      @MoxetKhanPK  8 месяцев назад +1

      So someone refresh the page 5 times but it counts 1?

    • @brusbezerra
      @brusbezerra 8 месяцев назад

      @@MoxetKhanPK yes

  • @DavidMurrin77
    @DavidMurrin77 10 месяцев назад

    I sort of have this working.
    The main problem is that the counter is added to if I refresh the post in the wordpress dashboard as well, rather than just on the front end

    • @engrrajonahmed
      @engrrajonahmed Месяц назад

      Run the code in the frontend only. Use code snippet plugin.

  • @iemvo9629
    @iemvo9629 2 года назад +1

    I use custom post type. And create the views meta field there. I tried the code but it doesn't work.
    Do I have to use metabox and create meta field?

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Make sure you placed the code in functions.php and the meta value is visible in CPT

  • @michaelakubas
    @michaelakubas Год назад +1

    Hi, thanks for video. I use post grid from unlimited-elements, and I add custom fields. But when I click on post is post count to all posts. Please help :)

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад

      Hello, just turn off other plugins and themes and check it on blank setting. Make sure get_the_ID() function in place so it can add only in that post.

  • @bharat61020
    @bharat61020 Год назад

    Hi Moxet, this video was really helpful thank you, but I am facing a issue the post views count does not increase when caching plugin is enabled..... When I disable caching for cpt single pages then everything works fine. Any idea on this??
    Thanks!!

  • @mrveeto6655
    @mrveeto6655 6 месяцев назад

    I'm using the Hello Elementor but don't have the child theme.. how to create the child theme?

    • @mrveeto6655
      @mrveeto6655 5 месяцев назад

      this method not working when i test

  • @seekknowledge1928
    @seekknowledge1928 2 года назад

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

  • @Muhammadkhan-uf4cl
    @Muhammadkhan-uf4cl Год назад

    you are the king

  • @toygarniron
    @toygarniron 2 года назад +1

    Hello Khan, This tutorial didn't work for me. I did exactly what I saw but the counter is somehow not working. Also, they all need to be updated one by one for the counter to appear on existing posts. It only seems to work on new posts. Where could I be doing wrong? Thank you

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Two things to consider in your case. Make sure to paste the code inside qp_enque_style, 2nd thing i mentioned in tutorial that the default value of meta must be zero so it applies on both new and old posts.

    •  2 года назад

      @@MoxetKhanPK I used child theme by crocoblock, and it don't have qp_enque_style, so where shoud I put your code
      /**
      * Child functions and definitions.
      */
      add_action( 'ocean_header', 'cb_child_do_header', -999 );
      add_action( 'ocean_footer', 'cb_child_do_footer', -999 );
      /**
      * Apply Crocoblock custom headers
      *
      * @return [type] [description]
      */
      function cb_child_do_header() {
      cb_child_process_location( 'header', true );
      }
      /**
      * Apply Crocoblock custom footers
      *
      * @return [type] [description]
      */
      function cb_child_do_footer() {
      cb_child_process_location( 'footer', true );
      }
      /**
      * Process single location
      *
      * @return void
      */
      function cb_child_process_location( $location = null, $cleanup = false ) {
      if ( ! function_exists( 'jet_theme_core' ) ) {
      return false;
      }
      if( ! defined( 'ELEMENTOR_VERSION' ) ) {
      return false;
      }
      $done = jet_theme_core()->locations->do_location( $location );
      if ( $done && $cleanup ) {
      $hook = current_filter();
      remove_all_actions( $hook );
      }
      return $done;
      }

  • @DomenicoMastroianni
    @DomenicoMastroianni Год назад

    Thanks for your videos, valuable content indeed. In regard to this post count, is there a way to add a post view based on user role? I'd like to create a front end notification to tell the user how many posts are new or marked as view (meta field not equal to 0). Hope it makes sense.

  • @purnendu.mukherjee
    @purnendu.mukherjee Год назад

    You are just awesome

  • @Website-Developer
    @Website-Developer 3 месяца назад

    Always like your stuff, but I would like a counter for posts published by users based on user roles and CPTs i.e. I have cpt1, cpt2, cpt3, cpt4 and a user role is assigned to each CPT such as user-role1 publishes to cpt1, user-role2 publishes to cpt2, user-role3 publishes to cpt3, user-role4 publishes to cpt4. Each member at their levels would then know how many posts they have published.

    • @MoxetKhanPK
      @MoxetKhanPK  3 месяца назад +1

      You can create query for that, select all posts from cpt1 and display the query result count of that query to user-role1 only. same goes for the rest.

    • @Website-Developer
      @Website-Developer 3 месяца назад

      @@MoxetKhanPK Thank you, and what if I have 10 users with user-role1? Will it determine how many posts each user has?

    • @MoxetKhanPK
      @MoxetKhanPK  3 месяца назад +1

      @@Website-Developer yes it will determine

    • @Website-Developer
      @Website-Developer 3 месяца назад

      @@MoxetKhanPK So I am assuming the each user role would need to have its own template as one template can not be used for all user roles correct?

    • @MoxetKhanPK
      @MoxetKhanPK  3 месяца назад +1

      @@Website-Developer It can be used for multiple user role as well.

  • @DJTechReviews
    @DJTechReviews Год назад

    This needs to be refined. This doesn't work very well. I've tried multiple ways and every time it seems to be counting 3 views for every single view.
    Plus, if you add the filter - the content disappears. Unless you return it using "return $content"

  • @michelfayadat1888
    @michelfayadat1888 2 года назад +1

    Thank you very much for the video.
    By the way, how can I insert the code since I'm not using a child-theme ?

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад +1

      You can add it directly to your theme or using php snippet plugin which helps you add php code anywhere.

    • @michelfayadat1888
      @michelfayadat1888 2 года назад

      @@MoxetKhanPK thanks a lot !

  • @bestfriendfhn
    @bestfriendfhn Год назад

    How can we display most viewed most using jet listing?

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад

      The data of your views are stored in database, you can run a query on your post and sort by VIEWS [Meta field]

  • @outlandermax
    @outlandermax Год назад

    Hi Moxet, thank you for your contributions with these handy addons. I just tested this with the encapsulated code and followed exactly how you got this working in the video, but unfortunately my pages are loading blank w. that code in the functions.php child theme.
    Any ideas if there are some setups that require a modification? Cheers!

  • @antonichristian5845
    @antonichristian5845 Год назад

    great video, thanks!!! what i'd like to know is it possible to order a jetengine listing by number of most views (most popular posts) using this method?

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад

      Yes why not, goto query builder and fetch your data sort by most views descending.

  • @arielolberg-swe
    @arielolberg-swe 2 года назад

    Can you do a video on how to count posts for certain taxonomy and show the counts in menu

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      You dont need code for that, take dynamic field and choose term count, it shows number of posts in a category

  • @tecnirf
    @tecnirf Год назад

    Hola, Intente hacer conteo de visitas a la Single User Page que crea el Profile Builder pero no funciono.
    Utilice tu Snippet pero con Get_user_meta y update_user_meta.
    Ayuda por favor!

  • @shakibkhan1921
    @shakibkhan1921 2 года назад

    Please Make basic to advance tutorial on Jet Plugins

  • @eacc95
    @eacc95 Год назад

    Great video. Question, what should I do if I don't want admin views to count? Thanks in advance

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад

      You can check from this answer whether the user is admin or not
      wordpress.stackexchange.com/questions/5047/how-to-check-if-a-user-is-in-a-specific-role/54837#54837

  • @DeveloperPromise
    @DeveloperPromise 3 месяца назад

    good

  • @VK-yj2kg
    @VK-yj2kg Год назад

    May I know is it possible add the view count into Jet posts using your code in a filter as below?

  • @xcantenerealguy1361
    @xcantenerealguy1361 Год назад

    How to make this counters when they go over 1000 to be 1k, and if in the case 1 Million to be 1M or even say 1.5k and etc?

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад +1

      In the output you have to apply this javascript code
      stackoverflow.com/questions/10599933/convert-long-number-into-abbreviated-string-in-javascript-with-a-special-shortn

  • @anamulhaque7680
    @anamulhaque7680 3 месяца назад

    I did the same way how you did, but somehow not working for me.

    • @giand9614
      @giand9614 3 месяца назад +1

      Add this:
      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');

    • @waitingza1978
      @waitingza1978 3 месяца назад

      @@giand9614 It works. But if used with the button (count click) What do I need to add?

  • @muhammadaslan6256
    @muhammadaslan6256 Год назад

    how we can do that for woocommerce prodcuts count and sales to show how much was sold this product

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад

      Use query builder instead, run a query which count products in orders table.

    • @muhammadaslan6256
      @muhammadaslan6256 Год назад

      can you guide me to do that ?
      i want to make default sales value and any one buy it the count will be improve it
      @@MoxetKhanPK

  • @user-xs8bz6nl3y
    @user-xs8bz6nl3y 2 года назад

    Can I somehow make a custom field that will display whether the user is online or not?

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Well it depends on environment; what mechanism you ll use to determine someone is online or offline, plugin might help. Manual will take timr

  • @ramdaniamarulloh6505
    @ramdaniamarulloh6505 2 года назад

    Thanks you broo

  • @simeon.benevrekov
    @simeon.benevrekov 2 года назад

    For some reason it doesn't work for me. I am trying to use the code snippets plugin to add the code, but I tried inserting it directly to the theme file editor, and still not working :(
    I've created a metabox, assigned that to the CPT needed etc.

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Did you tried to make meta boxes inside CPT instead of creating individual meta

    • @simeon.benevrekov
      @simeon.benevrekov 2 года назад

      @@MoxetKhanPK Yes. The first time I’ve just added a meta field to the CPT but the 2nd time, I’ve created a metabox and assign it to the CPT as you show. I reached to the support but they said that on the newest version might not work.
      Does it still work on your website?

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      @@simeon.benevrekov i ll try it with latest version of jetengine.

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад

      please encapsulate your code in a filter as below
      add_filter('the_content','view_counter');
      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);
      }

  • @coneqto
    @coneqto Год назад

    Dont work in single page :(

  • @Art-01
    @Art-01 2 года назад

    Thank you.
    Can you please make a video for Jet engine, about how to display multi color for product if we use Listing grid. I try to add colors to my product. Only colors.
    I can use color picker, but it show only one, i try to shows more then one
    I really hope you can help us with it.
    Thank you again

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Can you please eleborate more, how you will use those colors?

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад +1

      Can you please eleborate more, how you will use those colors?

  • @sergixelmusic6748
    @sergixelmusic6748 2 года назад

    If it's possible to reset the meta field 'posts-count' each 30 days to 0?

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Yes possible, you have to setup a cron job which throw an action after every 30 days. The cron job PHP will have the meta keys map with the table you want to reset.

  • @ProkomputerRup
    @ProkomputerRup Год назад

    Isn't adding 1 to view supposed to be when viewing a ticket? If you just put your code in a function, then the addition will occur when you open any page and not a specific ticket. You need to do this in function.php add cheking:
    if ( is_singular('ticket') ) {
    $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);
    }
    maybe Im wrong

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад +1

      please encapsulate your code in a filter as below
      add_filter('the_content','view_counter');
      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);
      }

    • @ProkomputerRup
      @ProkomputerRup Год назад

      @@MoxetKhanPK in this case function view_counter will be run befor showing every records.... Why not add a function call shortcode in single CPT template "ticket" ?

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад

      @@ProkomputerRup it totaly depends on your requirement and the way it should execute be it in footer, header, single page or home page, for logged in for guest and so on.

  • @ZiabisMotors
    @ZiabisMotors Месяц назад

    2024 no funciona :( Lo hecho tal como explicas en tu video

  • @kingmatolo8381
    @kingmatolo8381 Год назад

    Unfortunately it didn't work for me. I successfully added the post count meta field and I can see it when posting or editing a custom post.
    I copied the code on function.php file. The problem is my view count is stuck at zero. Nothing happens . I have watch your video multiple times step by step but for some reasons it doesn't work for me.

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад +1

      please encapsulate your code in a filter as below
      add_filter('the_content','view_counter');
      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);
      }

    • @thomasanderson5873
      @thomasanderson5873 5 месяцев назад

      @@MoxetKhanPK Thank you, now is working. :)

  • @AlexanderHernandez-nw9el
    @AlexanderHernandez-nw9el Год назад

    This is amazing! Could you explain how I could reset that counter every 24 hours? I have a WooCommerce shop that I'd like to display how many people have explored this product in the last 24 hours, and then have it reset after the day ends.

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад

      You can reset meta values throgh cron job

  • @nikoweb
    @nikoweb 2 года назад

    I don't get it. I made Meta box for my posts, made meta field with exact posts-count Name/ID, added function to the child theme functions.php but the count value won't go up when refreshing the post.

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Is there any cache etc plugin installed? Make sure to change the theme temporaly and apply the changes. I did the exact same thing in tutorial and it works.

    • @nikoweb
      @nikoweb 2 года назад

      @@MoxetKhanPK There was, tried without caching but couldn't get it to work.

    • @nikoweb
      @nikoweb 2 года назад

      @@MoxetKhanPK Tried it on fresh local WordPress installation and can't get it to work. Tried with normal posts and made a test CPT, doesn't update the value when visiting the page.

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад +1

      @@nikoweb Please DM me on facebook to resolve it, i saw your comments on facebook community as well.

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад

      please encapsulate your code in a filter as below
      add_filter('the_content','view_counter');
      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);
      }

  • @ShakilHossainDeveloper
    @ShakilHossainDeveloper 2 года назад

    I have no child theme what can I do now?

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Add directly in function.php or install code snippet plugin

  • @aaizazz
    @aaizazz 2 года назад

    Brother Please create different playlists for relevant videos, and add that in playlists. So new commers to the channel or anyone can easily find the Videos which they want to watch

  • @karimsahraoui7216
    @karimsahraoui7216 Год назад

    how to diplay count of current user only

    • @MoxetKhanPK
      @MoxetKhanPK  Год назад +1

      You can use data store for that, it counts in user meta.

    • @karimsahraoui7216
      @karimsahraoui7216 Год назад

      @@MoxetKhanPK couldn't find thanks anyway

  • @niceshortschannel6742
    @niceshortschannel6742 2 года назад

    Kar ko allah de kamyab ka

  • @mokona_0992
    @mokona_0992 2 года назад

    Loving your videos!
    Since you know your way around JetEngine, I have a quick question I hope you can answer. Is it possible to display user data (using data stores) in a dynamic chart against a meta field?
    For example, I have a library with three states (reading, planned, completed) = data stores. Historical books are separated into different centuries (1st, 2nd, 3rd) = meta field - radio field. The problem is, I can’t figure out how to display the data in a dynamic chart where my users can see their progress broken by century.
    Is this not possible or perhaps another way of using JetEngine to achieve this?

  • @roppor2194
    @roppor2194 2 года назад

    Next video pls

  • @suleiman8360
    @suleiman8360 2 года назад

    Can we have user views

    • @MoxetKhanPK
      @MoxetKhanPK  2 года назад

      Yup! We can have the same in user meta but we need to make sure the time script load is not in CPT but user instance.