Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Yep, check here.

    Thread Starter colinsp

    (@colinsp)

    Hector,

    Thanks for that link. Unfortunately it isn’t pulling the number of views of the CPT’s they are being shown in the admin panel though.

    Any other thoughts?

    Plugin Author Hector Cabrera

    (@hcabrera)

    That’s odd. The function I linked above should return the views count regardless of the post type.

    Could you please upload your single.php file to pastebin.com so I can examinate the code?

    Thread Starter colinsp

    (@colinsp)

    Thanks it is in pastebin at RQ1aqCjF

    Plugin Author Hector Cabrera

    (@hcabrera)

    Just checked on localhost and this works for me:

    <?php
    $views = wpp_get_views( get_the_ID() );
     echo '<div class="cs_detail_content" style="font-size:0.7em;">'.$views.' since 1st July 2014.</div>';
    ?>

    … returns “2 since 1st July 2014”.

    What’s happening on your side?

    Sorry for interrupt. Does WPP counts view for single-slug.php?

    I have a CPT is Movie (Slug:movie) relating with single-movie.php. The problem is that WPP does not count any views of it meanwhile the normal posts with single.php still are counted views

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi nkgeek,

    The plugin should count visits for every single entry, including custom post types (though I haven’t tested this in a while). If it doesn’t work for you, please share your site’s URL so I can go take a look.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Update: @nkgeek and @colinsp, another user reported similar issues with custom post types, so it must be a bug. I’ll take a look into it as soon as possible, so thanks for the notice!

    WPP work with CPT that in single.php, but not work with CPT that in single-slug.php. I am looking forward to the new version. Thanks

    Plugin Author Hector Cabrera

    (@hcabrera)

    If the plugin is able to update views count with single.php, then it must be something else. Could you please use pastebin or a similar service to share the full code from your single-slug.php file?

    oh. the structure just like single.php. just modify some html code to display. I am using spike theme of MyThemesShop, the CPT is FILM (slug:film) created by plugin TYPES.
    https://pastebin.com/k7pbFyUc

    Plugin Author Hector Cabrera

    (@hcabrera)

    Alright, just did a test using the Twenty Ten theme:

    1. Duplicated single.php and renamed it to single-promo.php (a CTP I created for this experiment).
    2. Visited a CTP entry, and the post view was registered correctly.

    So, my guess is that something in your theme must be conflicting with WPP. Can you please share your site’s URL so I can go take a look?

    Thread Starter colinsp

    (@colinsp)

    Hector,

    Thank you for your ongoing support. I now no longer require your help as I have resigned my position with the organization for whom I was building the site.

    I will certainly remember your plugin and the support that you offer should the need arise in the future. My theme of choice is Suffusion and that is what I was using on this site.

    Hi Hector, I found out why it is not counted. My CPT has only 1 image included in the_content();. When I add some texts to the CPT post, it started to count well.

    Hi Héctor. I have the same problem here. I am using this plugin to manage events:

    Your plugin is counting visits for posts and showing the popular posts with wpp_get_mostpopular but not for the events (CPT “tribe_events”).

    Have you some advice regarding nkgeek’s comment?

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘How to display number of views in custom single.php for a CPT?’ is closed to new replies.