Questions tagged [views]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

How to reset post views count

I need to reset the post views count of a web site. Currently Im using this on my functions.php: function getPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($...
user avatar
0 votes
0 answers
18 views

Count the total views of all user posts published

I have 1 essential questions I want to count the total views of all posts published by a user (login user). for example show: total view of your all posts: 485 Is there a way to do this? Can you help ...
user avatar
0 votes
0 answers
34 views

Best way to fix bad count on All | Mine | Published

I tweaked the default behavior of the post listing page (for a custom post type) via pre_get_posts, the thing is that now the count of All | Mine | Published isn't the right one. I'm aware there is ...
user avatar
  • 1
0 votes
0 answers
27 views

Why "Mine" is the default view when adding 'capability_type' in register_post_type

I'm tweaking default's wordpress permissions by adding my own via the capability_type and map_meta_cap in register_post_type(), but I noticed that as soon I add the capability_type argument, the ...
user avatar
  • 1
0 votes
1 answer
279 views

Display a list of users who have viewed the post you are viewing

How would I display a list of users who have viewed the post you are viewing?
user avatar
  • 976
0 votes
1 answer
21 views

How to unlink all posts from tracking same amount of views

I'm trying to show the top 5 most popular ( most viewed ) blogs. It is working as it should and then I added a script in the functions.php to display the views just while I build this so I can see it'...
user avatar
  • 247
1 vote
1 answer
186 views

How to show post views on single.php page?

how to show post views on single.php? What I tried: function getPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ ...
user avatar
1 vote
1 answer
600 views

How to display post view count by date, week and month?

I am using the below code to display post views. How can I get the data for every day, week and month? function gt_get_post_view() { $count = get_post_meta( get_the_ID(), 'post_views_count', true ...
user avatar
0 votes
1 answer
58 views

restrict incrementation of post vies count when refreshing the page

I use a post views counter to save post views - function calculatePostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ ...
user avatar
0 votes
0 answers
97 views

How to show post views shortcode data for each post on Posts List Page?

Example: [shortcode id=""]. I just want to how to dynamically fetch each post ID on Posts Lists page over archive page or normal posts page inside the shortcode placed in excerpt. Currently I'm using ...
user avatar
  • 101
-2 votes
1 answer
1k views

How to make Fake Views on Wordpress

I dont know how to code and sorry for my bad english, so i found a code here to make a random views on my post views using $count = rand(700,999); which make a random views for my post but the problem ...
user avatar
  • 1
-1 votes
1 answer
113 views

Get users query makes the site loading time too big?

I'm trying to get the top 10 users in (specific roles) by the highest post views, but this code makes the site loading time too big, and I don't know why! I'm highly appreciated your help. <?php ...
user avatar
0 votes
1 answer
62 views

How can i show post views using specified post ID?

Here is the code... if ( !function_exists( 'getCrunchifyPostViews' ) ) { function getCrunchifyPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, ...
user avatar
1 vote
1 answer
85 views

Create a list-style post of popular posts for the week?

I've been looking for something that would automate the creation of a popular posts of the week blog post. So for instance, every Monday create post that is a list of the most popular posts from the ...
user avatar
  • 133
1 vote
1 answer
645 views

Get .subsubsub count of post per status queried using pre_get_posts

My following query using pre_get_posts shows the Author only certain posts or pages with certain statuses that s/he should only see and of what belongs to him/her. Is there any way I can get a count ...
user avatar
  • 514
0 votes
2 answers
521 views

Count category views - Is it possible?

I would like to show my most viewed categories (kind like the "WP-PostViews" plugin). I already did some research but I didn't find nothing about that. This made me think that it can't be done by ...
user avatar
  • 299
0 votes
1 answer
27 views

How to fix blog article view and share #'s?

This is about public views on the front-end of our blog. All newly published articles view counter & share #'s have stopped updating. So, if someone views the article or shares it on social ...
user avatar
1 vote
1 answer
58 views

Show content from database

This is my first post on Wordpress StackExchange, so please be gentle. I’ve been working with WordPress for some time but more as a front-end developer and not too much back end dev. I have a ...
user avatar
0 votes
1 answer
245 views

Add view to admin menu to filter for specific criteria ( If post is child of specific Parent )

add_filter('views_edit-page','addFilter'); function addFilter($views) { global $wp_query; $query = array( 'post_type' => 'page', 'post_status' => ...
user avatar
0 votes
0 answers
925 views

view counter update in WordPress REST api HTTP get

I use WordPress rest API for app communication with my site in need update post view counter when HTTP get API. I search a lot but nothing found about it, in a tutorial "Find popular posts with the ...
user avatar
-1 votes
1 answer
97 views

Remove pipe in views admin page filter

I want to remove the pipes wich are beetween the links in views in the admin page ( For instance in the users page admin) " All (2) | Cutomer (3) | etc... " . How can I do ? Somebody knows where ...
user avatar
1 vote
1 answer
70 views

How can I get global $post to work for CPT and update user?

Ive created a custom field in my user_meta which now I want to update the count each time one the user posts are viewed. Ive got this which works great for standard wordpress posts. However I need it ...
user avatar
  • 35
0 votes
0 answers
214 views

Author.php Page views counter

Wondering if some one can help me. Im looking for a page counter for the author.php Ive got about 300 authors on the site and they would like a counter to show them how many times there "profiles" ...
user avatar
  • 35
0 votes
1 answer
952 views

How to Display Most View Post in the template file?

I need to create most viewed post column in the template file, but based on post view count? Function File function wpb_get_post_views($postID){ $count_key = 'wpb_post_views_count'; $count = ...
user avatar
1 vote
2 answers
3k views

How can I count post views of REST API calls and update them in an ACF field?

I don't know if I've complicated things a bit, so I'll explain things from the top. I have a set up with a custom post type (news), which is exposed via the REST API. The main endpoint (/wp-json/wp/v2/...
user avatar
  • 724
0 votes
1 answer
128 views

How to keep variable `$post` to using in another file

I create a plugin to quick payment. When user click button Quick pay. It show popup call views/display-popup.php. In this file, I declare variable $post. <?php global $post; $id = $post-&...
user avatar
  • 125
2 votes
1 answer
199 views

Change post category based on latest posts views

I have a custom field called post_views_count which stores the views of each post on my blog. I would like to use these views to decide which category the posts belong. Here is what I would like to ...
user avatar
0 votes
1 answer
478 views

How can I create the number of custom post views

I am creating a forum plugin and need to count how many people have seen a certain topic (post_type custom), ideally would be to create a new table or there is a form directly with wordpress.
user avatar
4 votes
2 answers
159 views

Custom Post Type With Different Views

We are rebuilding our website in Wordpress and are trying to figure out the best solution to display a different views of the same product with unique meta data. For example, let's say that Property ...
user avatar
1 vote
2 answers
1k views

How to improve post views count display?

I wanted to know if i can change the way i display views count in WordPress. Example: 1000 views = 1k - 10000 views = 10k I'm counting and viewing post views by using this code: // Count views ...
user avatar
-1 votes
1 answer
1k views

Get taxonomy image for Toolset custom taxonomy through Toolset Views Shortcode

I'm using Toolset Views to display a list of taxonomies. These taxonomies are under a custom Taxonomy that I created with Toolset Taxonomies. I then used the plugin Taxonomy Images to add the option ...
user avatar
0 votes
2 answers
25 views

Readers can't view my pages/post whitout logging in?

I don't know what I did wrong but public can only access my front page. Once you click on another page you are ask to log in. I think this is a new issue and maybe due to wrong setting somewhere. But ...
user avatar
0 votes
1 answer
1k views

How to display total views of all posts of one category?

Is there any way to display total views of all posts of one category? How to show that number on archive page? I have used this code to count views of each post: function getPostViews($postID){ $...
user avatar
2 votes
1 answer
597 views

Double count view in archive.php

I'm having a hard time using this snippet I'm getting double views each time the post is queried. This is in my functions.php file: function getPostViews($postID){ $count_key = 'post_views_count';...
user avatar
0 votes
1 answer
48 views

To remove rendering of menus and header, plugin or theme?

I need to create a view of my website which does not render the header (where I see my user name) and maybe display just one menu on the side. Do I achieve this through a plugin or through creating a ...
user avatar
0 votes
1 answer
105 views

How can I make post view count editable? [closed]

In the admin panel, under posts, I see all posts with their view counts next to them. How can I make the view count editable? I am working on certain things that will kick in when a post reaches 100 ...
user avatar
3 votes
0 answers
81 views

Tinymce shortcodes within shortcode contents

I am using wp.mce.views.register to create a simple view for my shortcode in the tinymce editor, this works fine but i am looking for a way to have "nested" shortcodes e.g. [column_3] [info_box] ...
user avatar
0 votes
0 answers
1k views

How to display most popular post by views count in WordPress?

I tried to display the most view post in last 30 days in my WP page, how to do this? What I did is: <div>Most Read Blog Posts Over Past 30 Days</div> <?...
user avatar
  • 25
0 votes
1 answer
621 views

Get total views of all posts by author

I would like to display the total amount of views per author for all posts. What would be the best way to achieve this without causing too much load on the server?
user avatar
  • 211
0 votes
1 answer
3k views

Post Views / Hit Counter Problem?

I have decide to use WordPress as a CMS to my 5 moths old website. I have already added all previous posts to my new site ( WordPress ). But now I need to change view counts to previous views counts. ...
user avatar
  • 5
0 votes
1 answer
151 views

Searching for meta_key returns 0 posts

I am currently on a client project and I am stuck with the meta_key search in WP_Query. I am querying some other parts of the homepage successfully with the WP_Query class, but when I am passing array(...
user avatar
-1 votes
1 answer
2k views

Display (custom) post number of views

I'd like to display at the top of every post (actually those are custom posts) the number of times it was viewed by users. Is there a way to do this ?
user avatar
0 votes
0 answers
25 views

Pageview all of sudden not working

I am not sure how to explain it. MY page view count is not working all of sudden. Here is my code: $output .= '<div class="mainpageview fa fa-eye">'; $views = get_post_meta( $post->ID,...
user avatar
  • 345
0 votes
1 answer
40 views

Showing "0" pageview when there is no view

So, I have the following code to display pageview: <div class="mypageview"><?php echo get_post_meta( $post->ID, 'pageview', true );?>page view</div> For example, if there is any ...
user avatar
  • 345
0 votes
1 answer
1k views

How get top post view for today for today post

I insert today 20 post for example. And i need to get top post that show today from today post. I try this code but its show me top post view for all time. But I need only for today post. $day = ...
user avatar
-2 votes
1 answer
843 views

Updating post_views_count on publish [duplicate]

Upon publishing a post, I'd like the post views count to be a random integer between 829 and 1013. Could you please tell me what code I need to add to functions.php in order to achieve this? Thank ...
user avatar
-1 votes
1 answer
3k views

Increasing post view count automatically [duplicate]

I am testing a ranking system for posts, and I'd like help with the below: Upon publishing a new post, I'd like the post view count to immediately have a random number between 829 and 1013 added to ...
user avatar
3 votes
1 answer
2k views

WP Admin default view mode for Custom Post Type

To change it globally to excerpt for every post type I can use: function my_default_posts_list_mode( $default ) { return 'excerpt'; } add_filter( 'default-posts-list-mode', '...
user avatar
  • 1,312
-2 votes
2 answers
501 views

Post rank by views

I want show: Post id 5 has 100 views and rank is 2nd, post id 6 has 90 views and rank is 4th, post id 7 has 1100 views and rank is 1st I try: $query="SELECT u.*,um.post_id, FIND_IN_SET( ...
user avatar
3 votes
1 answer
3k views

Creating a custom MCE view for your shortcodes [closed]

How to create a custom MCE view of my own WordPress shortcode?
user avatar
  • 357