Support » Plugin: Toplytics » How to show events and pages

  • Resolved hdraye


    Great plugin
    I have events (eventon plugins) and events are more popular than posts, but only stats for posts are shown, how can I show events stats or pages please?

    Also where can I find the shortcodes, I am using the wifget now.


Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Presslabs


    [toplytics period="today" numberposts="15" showviews="false"]

    Is an example of the shortcode syntax unfortunately there is no guide / mention of it in the plugins description.

    As for the custom posts not being retrieved this is currently not possible (articles are fetched but are filtered due to a wordpress inconsistency). I’ve added an issue and it will eventually be possible to do so.


    Plugin Author Presslabs



    You can add/edit your custom post type using the filter ‘toplytics_allowed_post_types’ see

    The shortcode is also visible on first page

    Best regards

    How would I know the post types please?

    and should I replace toplytics.php with the one mentioned in your post as mine hase no allowe types line

    Hi again
    this is an event link

    in the source view I found thi:

    so is ajde_events a post type?

    also can I have different widgets for different post types, like popular psts, popular events and popular pages?

    Plugin Author Presslabs


    Yes this is the post type value “ajde_events”. Add this post type to your list, using the filter ‘toplytics_allowed_post_types’ in order to tell to Toplytics to accept this custom post type.

    How to update the plugin please, it shows that I have ver 3 while the php file does not have the filter you are talking about, should I over write it with the one you mentioned?

    And again, is it posibble to have diferent widgets for different post types?


    Plugin Author Presslabs


    Sorry, my bad. Can you try to update the plugin again?

    About the using of different widgets for different post types, this feature is not available because the logic of the plugin does not allow this right now. It’s a nice idea and I will righted down in order to not forget it.

    I don’t know how much helps you but you can use more widgets (using the same template) but with different options like: period, numberposts and/or showviews.


    Hi again
    this changes still show posts only but not events

    $allowed_post_types = apply_filters( ‘toplytics_allowed_post_types’, array( ‘post’,’ajde_events‘ ) );

    Am I doing it wrong?

    Plugin Author Presslabs


    It’s ok how you write the code, but a better way will be to use the filter properly like this:

     * Plugin Name: Toplytics allowed post types
     * Description: Add the post type 'ajde_events' to Toplytics plugin.
    add_filter( 'toplytics_allowed_post_types', 'toplytics_add_allowed_post_types' );
    function toplytics_add_allowed_post_types( $allowed_post_types ) {
    	if ( ! in_array( 'ajde_events', $allowed_post_types ) ) {
    		$allowed_post_types[] = 'ajde_events';
    	return $allowed_post_types;

    You can try yo debug the code, by getting the correct post type (maybe it’s not the correct one). Try to use the plugin Debug Bar and Debug Bar Console in order to get the correct post type. Install those plugins view one event page and click the Debug option from the Admin Bar and see what post type is there.

    • This reply was modified 1 year, 11 months ago by  Presslabs.

    Where should I paste this code please?

    Plugin Author Presslabs


    Create a new directory named ‘toplytics-allowed-post-types’ and then, inside of the dir. paste the code into a file named ‘toplytics-allowed-post-types.php’. Then archive it as zip and add it as a plugin or copy paste it via FTP inside of wp-content/plugins/ dir.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to show events and pages’ is closed to new replies.