You can simply do it by adding 300 when displaying count as shown in following code:
<?php echo 'TOTAL POST VIEWS: ' .(intval(wpfp_get_current_count()) + 300); ?>
and instead of echoing that values in function return it as shown in following code:
function wpfp_get_current_count() {
global $wpdb;
$current_post = get_the_ID();
$query = "SELECT post_id, meta_value, post_status FROM $wpdb->postmeta";
$query .= " LEFT JOIN $wpdb->posts ON post_id=$wpdb->posts.ID";
$query .= " WHERE post_status="publish" AND meta_key='wpfp_favorites' AND post_id = '".$current_post."'";
$results = $wpdb->get_results($query);
if ($results) {
foreach ($results as $o):
return $o->meta_value;
endforeach;
}else { return 0;}}
For more information on intval() function refer this page.
Related Posts:
- C++ – how to find the length of an integer
- How can I make a PHP counter?
- Counting the posts of a loop (WP_Query)?
- Category and children post count
- Hide the post count behind Post Views (Remove All, Published and Trashed) in Custom Post Type
- How to display 2 equal columns of li based on the count of items in wp_nav_menu divided by 2?
- Show weekly posts statistic in WordPress
- Increasing post view count automatically [duplicate]
- Count number of posts by author in a category
- How we count the user draft posts
- What is the best way to count and display the number of posts?
- Get count of terms with a post and another taxonomy term?
- Get Gravity Forms field values and count how many? [closed]
- Counting posts in custom post type by author
- Show ellipsis (…) only if the number of characters exceeds limit defined in substr
- Get total views of all posts by author
- Count post + add number =
- Count posts published in one particular day: the lighter way
- What is the best way to do this? [closed]
- Search Count WordPress Theme
- How to read out the excerpt length (for if-condition)
- $count_posts->draft & published
- CountPost WordPress Custom Taxonomy
- get the count of table rows
- How to calculate posts number? [closed]
- How make animation increase of number
- Having problems getting the number of plays in a WordPress Playlist from an audio file
- How to show the amount of post that have on the site?
- Counting the number of elements with the values of x in a vector
- PHP 7.2 – Warning: count(): Parameter must be an array or an object that implements Countable
- How can I count the occurrences of a list item?
- Count how many files in directory PHP
- count posts from custom taxonomy terms by year
- Count posts or custom post types from last 24 hours (or from today)
- Comment Count for each Comment Author
- Display user’s total comment count outside The Loop
- Count posts that have specific taxonomy term attached
- Count number of post in Taxonomy?
- How to use global post counter in the loop?
- Taxonomy list. Order by a specific custom post type count
- Count posts for each year
- How do I count how many top level categories there are?
- Show that current post is number X out of X
- Check if an array of posts has posts from a specific category
- get_queried_object error How to show post count by month in the taxonomy page
- wp_count_posts, wp_count_terms and wp_count_comments for specific user?
- How to count custom post types with conditional operators
- Count posts with specific term_meta
- Count all comments of a custom post type
- How to count rows of table in the_content()
- Adding country tags automatically
- Query/list all terms and their custom post count
- Fastest way of counting posts of a custom post type in a specific taxonomy term?
- Post count by month of taxonmy term
- custom post type category count shortcode
- How to update the counter of private pages in the dashboard?
- check if author has published posts in custom post type, then send mail
- Getting comment count per post not working
- How to count posts with specific arguments
- How to display author post count for multiple custom post types?
- Show posts count for Categories and Tags in wp_nav_menu
- Count number of posts of current month
- How to show the number of website visitors in my theme
- How can i count post from my post type taxonomy
- How can i count the post added in relationship field, theme display
- Show the amount of posts in a tag in a specific category has
- How can I count ACF sub_field with a certain value
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- Get Author Count By Day, Week and Month
- How to count other posts not having specific taxonomy terms?
- counting trackbacks, pingbacks and comments of a post
- Divide post content in three columns
- How to Define Custom Number of Items in Comment Feed
- Order terms by count – missing terms
- Count user posts and store the number for later use
- How include comment and post count of user in this custom query
- Allow a specific user role I have created to only upload one image to his media library
- Author post count in category
- How can I show how much water got saved on this order (making use of the number of items bought) on a thank-you-page?
- get_queried_object not work in taxonomy page
- Show post count in custom taxonomy page
- How Can I add show_post_count in get_archives_link?
- Modify the category post counting function
- Implementation to count page visits of unique visitors based on a cookie
- Display number of post published every day
- Add subcategories posts to the counts column at the admin’s categories list
- WPDB delivers wrong results from complex queries
- count_posts to a standalone link
- For each 3 posts, show a different post type
- divide custom field values in div every two values
- Counting custom post type with wp_count_posts returns an empty object
- How to mark every 3rd post
- Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)
- How to add a post counter to the list of custom taxonomy terms?
- How to limit the number of posts a user can publish based on user type
- ho can I get the number of the current post instead of the post id?
- How to add together (get the sum) a field from all author’s posts
- Counting number of identical meta keys
- How do I count the number of pages a user has seen on my site, and force them to log in after a certain amount
- Count the number of matching post names in foreach loop