Can’t use toplytics_results function in theme
-
Hi there,
I installed the plugin and set it up connecting to GA fine, but I’m using a theme that isn’t widget aware:
“The theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change.”
This means the widget link on the settings page for the plugin doesn’t work (broken link to https://www.mywebsite.com/wp/wp-admin/%7B!!%20admin_url(‘widgets.php’)%20!!%7D)So I followed the instructions to use the function in a template directly:
“How can I use the plugin functionality outside the sidebar? The plugin offers 2 functions that can be used either in the theme or by another plugin.”
https://www.presslabs.com/docs/code/toplytics/how-to-use-toplytics/Using this code:
<?php $toplytics_args = array( 'period' => 'month', // default=month (today/week/month) 'numberposts' => 7, // default=5 (min=1/max=250) 'showviews' => true // default=false (true/false) ); if ( function_exists( 'toplytics_results' ) ) toplytics_results( $toplytics_args ); ?>
But this fails as the ‘function_exists’ is false.
Is there something I’m doing wrong? The theme is also a Roots/Bedrock/Sage variety, not sure if that’s relevant?
Thanks for any help.
- The topic ‘Can’t use toplytics_results function in theme’ is closed to new replies.