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

  • Resolved hdraye

    (@hdraye)



    Hi
    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.

    regards

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

    (@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.
    Issue: https://github.com/PressLabs/toplytics/issues/115

    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.

    Issue: https://github.com/PressLabs/toplytics/issues/114

    Plugin Author Presslabs

    (@presslabs)

    Hi,

    You can add/edit your custom post type using the filter ‘toplytics_allowed_post_types’ see https://github.com/PressLabs/toplytics/blob/master/toplytics/toplytics.php#L438

    The shortcode is also visible on first page https://wordpress.org/plugins/toplytics/

    Best regards

    Thanx
    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
    http://riyadhkey.com/eevents/%D9%85%D8%B9%D8%B1%D8%B6-%D8%A7%D8%AA%D8%AC%D8%A7%D9%87%D8%A7%D8%AA/

    in the source view I found thi:
    “postType”:”ajde_events”

    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

    (@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?

    TIA
    Hani

    Plugin Author Presslabs

    (@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. https://github.com/PressLabs/toplytics/issues/116

    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.

    Thanks

    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

    (@presslabs)

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

    
    <?php
    /**
     * 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.

    Thanx
    Where should I paste this code please?

    Plugin Author Presslabs

    (@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.