• Hey. Was just wondering why on one page it kept forcing out the viewcounts and came across this code on the shortcode class on _validate_args()

    if ( isset( $args['showviews'] ) ) { // showviews (true/false - default=false)
    	$args['showviews'] = true;
    } else {
    	$args['showviews'] = false;
    }

    That’s kinda annoying in the sense that even if you have set showviews=”false” it’s still set, and thus this forces it to be true.

    If you want to handle the default like this I guess something along the lines of

    if ( isset( $args['showviews'] ) && $args['showviews'] !== false )

    would be better.

    Thanks.

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

    (@presslabs)

    Hello @jimihenrik,

    You are correct. That way of doing the args validation is not the proper way. As you suggested your way is how it should be.

    We’ve been working on a new version of this plugin for some time already, yet our efforts are fully focused on our new hosting product at the moment.

    Still, you can check out how the new version will work using our Github repository, there is even a pre-release version available here: https://github.com/presslabs/toplytics

    Thread Starter jimihenrik

    (@jimihenrik)

    I’ll check the github, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘About the shortcode class’ is closed to new replies.