Giter Club home page Giter Club logo

wp-postviews's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

wp-postviews's Issues

Backup view counts before reinstall WordPress

Sir,
First of all thanks for the plugin.
I need to reinstall my WP blog site. Is any option to store and restore view counts? I took backup my site without plugin backup. just took post, page and database backup. So I'm scared about loss the view counts. Can you give me any suggestion please?

Post views by Day/Week/Month

Hello,

I use your extension long time. But I would like to extend it .

I want show post by views with interval of time day/week/month.

I have found ressource like this (http://wordpress.org/extend/plugins/wordpress-popular-posts) :

function wpp_get_views($id = NULL, $range = NULL, $number_format = true) {

    // have we got an id?
    if ( empty($id) || is_null($id) || !is_numeric($id) ) {
        return "-1";
    } else {
        global $wpdb;

        $table_name = $wpdb->prefix . "popularposts";

        if ( !$range || 'all' == $range ) {
            $query = "SELECT pageviews FROM {$table_name}data WHERE postid = '{$id}'";
        } else {
            $interval = "";

            switch( $range ){
                case "yesterday":
                    $interval = "1 DAY";
                break;

                case "daily":
                    $interval = "1 DAY";
                break;

                case "weekly":
                    $interval = "1 WEEK";
                break;

                case "monthly":
                    $interval = "1 MONTH";
                break;

                default:
                    $interval = "1 DAY";
                break;
            }

            $now = current_time('mysql');

            $query = "SELECT SUM(pageviews) FROM {$table_name}summary WHERE postid = '{$id}' AND last_viewed > DATE_SUB('{$now}', INTERVAL {$interval}) LIMIT 1;";
        }

        $result = $wpdb->get_var($query);

        if ( !$result ) {
            return "0";
        }

        return ($number_format) ? number_format_i18n( intval($result) ) : $result;
    }

}

Someone can help me?

Unique visits

Is it possible to count only unique visit form registered users? I need to know how many registered users viewed my post, so I need to count only their first visit. Is there any way to do this? Thanks.

Sticky post should be exclude from the Widget

In current version, if there is a sticky post, it will include in all queries such as most_viewed. Then it will show $limit + 1 records, and the sticky post is the first one. I think it's not the expected result in most cases. So would it be better to add a condition ignore_sticky_posts in WP_Query?

Want to call all Post View in another plugin

Hi, my name is Galang you can call me Mz, i want to integrated your plugin, in my first plugin wordpress, can you explain me what should i do if i want to count all view in my all post depend on the user id, if u have an email address please contact me in [email protected]

Jetpack WP Stats Integration

I can see in the change log that you mention a fix for WP Stats integration. I've installed WP Postviews into a website that is integrated with Jetpack Stats (which I assume is the WP Stats mentioned in the fix). The view counts shown by the [views] shortcode do not appear to reflect historical WP Stats data. Have I misunderstood the plugin's features or do I need to alter a setting?

Incrementation not working for mobile

Hello,

I'm running into an issue with the plugin on the counter.
When I refresh a post 10 times on my desktop, it works like a charm, my post has 10 more views. But when i'm accessing to the same post on my phone, nothing happens.

There's no cache plugin installed.

Thank you for your help !

custom orderby meta wp_query "fix"

I post this here because I had issues with a custom loop ordered by views. It didn't show posts that didn't have the views meta_key.

Run this once in your functions.php and remove after.. or let it sit there but there really is no need for it.

This code adds a meta_key views if the post doesn't have one and fills the value with a 0.

add_action( 'init', 'post_views_default' );

function post_views_default() {

    if ( get_option( 'post_views_setup_has_run' ) )
        return;

    $args = array(
        'posts_per_page' => -1,
        'fields' => 'ids',
        'post_type' => array( 'post', 'page' )
    );
    $viewsToZero = new WP_Query( $args );

    foreach ( $viewsToZero->posts as $post ){

        if ( ! get_post_meta( $post->ID, 'views', true ) )
            add_post_meta( $post->ID, 'views', 0, true );
    }

    add_option( 'post_views_setup_has_run', 'yes', $deprecated = '', $autoload = 'yes' );
}

Insert icon to count

Hi

I love this plugin and was hoping you could show me how to insert a "class" so I can insert an icon like example an eye before the count number.
Thanks

Error when WP_CACHE isn't defined

" Notice: Undefined index: views_use_ajax in /srv/www/wp/wp-content/plugins/wp-postviews/postviews-options.php on line 26"

Around line 90 you have the following to display a specific field (use_ajax):

... view_option['use_ajax'] ... yada yada

So when you are checking the submit data and setting view_options you should probably exclude views_use_ajax from the array, and then include the view option under the same constraints:

if( defined( 'WP_CACHE' ) && WP_CACHE )
$views_options['use_ajax'] = intval( $_POST['views_use_ajax'] );

Google Analytics

What do you think about adding support for Google Analytics?

GA usually gives more accurate data of page views. We can add an option for users to retrieve data from GA instead of relying on the plugin's manual implementation.

I know there's already several plugin that does exactly this but the implementation is mostly too heavy and have unrealistic use case.

help about smof category

I want to display posts from two different categories in WordPress. The categories should have their own styles. But I can't make it work properly. The post appears but not in date order or limited to five posts.

Problem wirh W3TC database cache

I am having problem using this plugin with w3tc
the views are not updated every time the page loads (though its logged)
how to solve this?

Is it useful on WordPress 5.7.1

Recently , I updated wordpres to 5.7.1, and I found the postview is not useful.The count is not changing now.
Is it useful on wp5.7.1,or I just used it wrong.

pt_BR translation

I've translated the plugin into Brazilian portuguese, I do not know if this is the right place to post since I'm kinda new here, I don't know how to attach a file either so I've uploaded a zip file containing the wp-postviews-pt_BR.mo and wp-postviews-pt_BR.po into depositfiles

[http://depositfiles.com/files/wsgasawid]

wordpress 5.0.1 warning

When I install 1.7.6 on wordpress 5.0.1.There are two line Warning message in the admin's article page:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'sort_postviews_column ' not found or invalid function name in /www/wwwroot/wordpress/wp-includes/class-wp-hook.php on line 286

Warning: Invalid argument supplied for foreach() in /www/wwwroot/wordpress/wp-admin/includes/class-wp-list-table.php on line 967

And when I disable the wp-postviews , this warning message disappear

Views doesn't update

I have installed a plugin, added php line into single.php, but it still doesn't work. I have cache plugin but it still should work if I turn off Use AJAX To Update Views right?

Undefined variable: should_count in wp-content\plugins\wp-postviews\wp-postviews.php on line 118

  1. Enable xdebug for php as usual, zend_extension_ts=c:\php-tools\php\ext\php_xdebug-2.1.0RC1-5.2-vc6.dll
  2. Enable wordpress debug define('WP_DEBUG', true); in wp-config
    That will cause php notice messages to be displayed.

Create custom page template with the_loop which shows only one page. Create a page basing on the template and try to see it. You'll get

[15-Sep-2013 11:49:43] PHP Notice: Undefined variable: should_count in C:\php-tools\wp-novostroyka\wp-content\plugins\wp-postviews\wp-postviews.php on line 118
[15-Sep-2013 11:49:43] PHP Stack trace:
[15-Sep-2013 11:49:43] PHP 1. {main}() C:\php-tools\wp-novostroyka\index.php:0
[15-Sep-2013 11:49:43] PHP 2. require() C:\php-tools\wp-novostroyka\index.php:17
[15-Sep-2013 11:49:43] PHP 3. require_once() C:\php-tools\wp-novostroyka\wp-blog-header.php:16
[15-Sep-2013 11:49:43] PHP 4. include() C:\php-tools\wp-novostroyka\wp-includes\template-loader.php:47
[15-Sep-2013 11:49:43] PHP 5. get_header() C:\php-tools\wp-novostroyka\wp-content\themes\novostroyka\page-templates\free-adv.php:11
[15-Sep-2013 11:49:43] PHP 6. locate_template() C:\php-tools\wp-novostroyka\wp-includes\general-template.php:35
[15-Sep-2013 11:49:43] PHP 7. load_template() C:\php-tools\wp-novostroyka\wp-includes\template.php:383
[15-Sep-2013 11:49:43] PHP 8. require_once() C:\php-tools\wp-novostroyka\wp-includes\template.php:407
[15-Sep-2013 11:49:43] PHP 9. wp_head() C:\php-tools\wp-novostroyka\wp-content\themes\novostroyka\header.php:21
[15-Sep-2013 11:49:43] PHP 10. do_action() C:\php-tools\wp-novostroyka\wp-includes\general-template.php:1607
[15-Sep-2013 11:49:43] PHP 11. call_user_func_array() C:\php-tools\wp-novostroyka\wp-includes\plugin.php:406
[15-Sep-2013 11:49:43] PHP 12. wp_enqueue_scripts() C:\php-tools\wp-novostroyka\wp-includes\plugin.php:0
[15-Sep-2013 11:49:43] PHP 13. do_action() C:\php-tools\wp-novostroyka\wp-includes\script-loader.php:806
[15-Sep-2013 11:49:43] PHP 14. call_user_func_array() C:\php-tools\wp-novostroyka\wp-includes\plugin.php:406
[15-Sep-2013 11:49:43] PHP 15. wp_postview_cache_count_enqueue() C:\php-tools\wp-novostroyka\wp-includes\plugin.php:0

I understand that PHP allows you to skip a variable definition, but being a Java developer I always define a variable and initialize it with default meaningful value, and I think it's a good practice to keep your code cleared from errors and unwanted messages.

I'd fix that with following:

function wp_postview_cache_count_enqueue() {
global $user_ID, $post;
if (!wp_is_post_revision($post) && (is_single() || is_page())) {
$views_options = get_option('views_options');

   $should_count = false;

Thanks.

To display the views of a separate post

I saw this link and succeeded. How to display by popular post.
However, it failed to display the number of views of a separate posts.
Page views are displayed, not separate post views.
(I use a translator because I can't speak English. I'm sorry)
캡처

Why "Views" Column in back-end is not sortable ?

I don't have the options to sort the views columns on my custom post type.
Should I do something special to enabled it ?

I found the sort_postviews_column function but can't get it working.

Thanks for your help

post view not showing

Hi
After updating your plugin to last version when i want to see all my posts i get this error
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘sort_postviews_column ‘ not found or invalid function name in /home1/sourcekh/public_html/learn/wp-includes/class-wp-hook.php on line 286
please help fast

How to use wp-postviews extention with Cache Enabler plugin?

I installed wp-postviews on site with Cache Enabler plugin activated.
Using standard, not async code provided in Readme
caused common problem with not updating current views (as I expected - this page is rendered and written to cache).
The only way for now is to clear cache manually and decrease cache lifetime.
But I can see that you provided some async code using JS and LiteSpeed Cache:
jQuery.ajax({
type:"GET",
url:viewsCacheL10n.admin_ajax_url,
data:"postviews_id="+viewsCacheL10n.post_id+"&action=postviews",
cache:!1,
success:function(data) {
if(data) {
jQuery('#postviews_lscwp').html(data+' views');
}
}
});

but this code closely connected with LiteSpeed Cache plugin params.
I need more universal solution, that I can use with Cache Enabler plugin.
I will appreciate if you adivse me some solution or snippet.

Create a Draft based on an existent Post/Page

Hi, first of all, thanks for this plugin.
It´s amazing and works very fine.
I realized, recently (probably since all), that when I copy an existent post as a draft to save time in edition, the came with the same views as the original one.

Did you already have the same experience?

Thanks

Edson Sobreira

image

Fix for working with cached pages

Hi there, we've been using your WP Postviews plugin for a while with one of our clients and found the need to alter the plugin for proper counts when the pages are cached. You may consider including the diffs in the patch here:
http://drop.bigdawggi.com/Hq4F

Enqueing the scripts this way also allows greater flexibility for other plugins to modify when the JS is included (i.e., for use with script concatenation plugins)

Since we've kept a mirror of the SVN plugin for a while at here, forking and issuing a pull request would be a little cumbersome, so you can just apply the few changes as needed from the patch above.

Glad to see you moving to Github!

Count by IP?

Any way to count by IP? I'm not interested in views being counted on refresh.

Cheers.

FR - Use vanilla JS (not jQuery) loaded in footer

This plugin seems useful, thanks! However, I can't use it because we don't want jQuery loading on our sites. I'm just making an official feature request if you could switch to fetch in JS instead of ajax in jQuery :)

Problem for pluralization

When there is only 1 visit show the plural label "visits" insted of "visit"

For example:

1 visits.
2 visits.

Is Not Updating

on my site the views are not updating in live
the update post view sometimes it not displaying the right amount of view

Posts with over 100 views showing before the ones with less than 100 in the query (desc. order)

I put in the "Dynamic OrderBy Field" the "view" field, and it is showing the proper posts in order of most accessed, to least accessed. But it does not show the posts with view count over 100 — and i guess they are in another place of the query, because i tested to show the posts in a category that has only 3 posts, one with 50 views, and other two with views over 100, and the one with 50 views showed up first, but the other two are in the correct order of most views. Anyone know how to arrange the query correctly and show the pages with over 100 views first?

Reset page/post views

Hello :-)

When copying a page or post to create a new design it also copies over the page views from the original post/page. How do you reset the view count for a page/post?

Thank you for the great work.

WP-JSON API Supported ?

  1. Is "wp-postviews" support +1 view when get post data from wp-json api ?
  2. Also, get this count in wp-json api

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.