Widget works but shortcode doesn't
-
Hey,
Got everything set up nicely – popped a widget in the sidebar & it works fine getting the 5 latest posts. Tried to do a shortcode however & it doesn’t work – all it brings back is one link for the front page even though it’s set to just bring back posts only, not pages.
My code is this:
<?php echo do_shortcode("[google_top_content pageviews=0 number=5 showhome=no time=2628000 contentfilter=post]"); ?>
Any ideas?
Thanks!
https://www.ads-software.com/plugins/google-analytics-top-posts-widget/
-
Are you still having issues with this? Are the settings you’re using in the shortcode the same settings you have in the widget?
Same thing over here. I’m pasting the shortcode provided in the description of the plugin’s page but it doesn’t render anything.
The widget however works great.
I’m starting to dig into the code, I’ll post if I find anything else.
Thanks!
The only useful data I can provide right now is that the shortcode outputs
despite if it’s using transtient or not. I couldn’t spot exactly where the code is exiting without getting the data correctly like the widget.
Note on the side: Adding “update” as a parameter in the shortcode as suggested in google-analytics-top-posts-widget.php at line 132 didn’t forced the transtient to be skipped, seems like the parameter is getting lost after applying the filters.
What is the site you have this installed on? Specifically the page with the shortcode/widget.
Having same problem here. Just using:
<?php echo do_shortcode('[google_top_content pageviews=50 number=10 showhome=no time=2628000 timeval=2]'); ?>
returns
<!-- not using transient --> <ol></ol> <!-- not using transient -->
but the widget works (and is also not using transient). I’ll continue looking through code if I can figure out what’s going on.
I’m trying to build custom rss feed, so it’s not in a context of page/post.
I am just using the shortcode on the page, but get the same issue as you guys. When I check the source code, I also see
<!– not using transient –><!– not using transient –>
Any ideas Justin Sternberg?
Hi, Thanks for the great plugin. The widget works fine but I can confirm the shortcode doesn’t work for me either. I am getting “using transient” however:
<!-- using transient --> <ol></ol> <!-- using transient -->
My shortcode works fine now. I probably had a caching issue. I installed and ran the plugin Artiss transient cleaner and after that the posts showed up with the shortcode.
I have the same problem as Mr Press, with no list generated with the shortcode (though the widget works okay) and the following HTML source code:
<!-- using transient --> <ol></ol> <!-- using transient -->
However, the transient cleaner plugin did not solve it for me. Anyone got another idea what might cause this?
There are a few things you may try. Make sure the GA Top content widget is deleted. Clear out all transients, not only those that have expired. Check that Google Analytics Dashboard is showing stats for your posts in the posts list in wp-admin. If you are using the plugin Bulletproof security make changes to the wp-admin .htaccess-file or remove the wp-admin .htaccess-file, which I had to do. Open your database sql-file in an editor like Notepad++ and search for “google_top_content”. You should find
_transient_timeout_dw-gtc-list-google_top_content
and_transient_dw-gtc-list-google_top_content
where the most viewed posts should be listed. Make sure your shortcode has the correct format, like:<?php echo do_shortcode( '[google_top_content pageviews=10 number=5 contentfilter=post showhome=no time=2628000]' ); ?>
If you for example put a pageviews number which is higher than the highest number of visits to your posts, nothing will show.
Hope this helps.
We are seeing exactly the same bug as above. we have cleared out transients. Still getting the “using transient” bug with no top content data. We have uninstalled the plugin and we have even reverted back to the 1.4.8 version of the plugin. Still the same bug exists, providing no data, just the “using transient” bug.
We have tried numerous different fixes, including the exact example shortcode on the plugin page with the same results and yes, all of our posts have more far more than 5 views. Also, please note that this plugin was working great before the 3.8.1 upgrade.
Also strange is that the daskboard top-content widget is working fine, so that leads us to believe it is just a simple bug in the shortcode that is not compatible with WordPress 3.8.1.
What is the status of getting this shortcodes bug fixed?
Appreciate your help and will gladly contribute a donation, if you can get this fixed in a timely fashion… Yes, that is a bribe.
I would not be so quick to label this as a bug. I had some difficulties getting the shortcode to work, but once I found out how the plugin functions I got the shortcode working the way to be expected. As a number of people here have reported difficulties perhaps the plugin isn’t running smoothly in all circumstances, but I wouldn’t label the shortcode problem as a bug nevertheless.
Have you tried to disable all your other plugins one by one to see if another plugin causes the problem with the shortcode? Do you have a .htaccess security plugin installed which may interefe with the Google Analytics Dashboard plugin? It’s very common for faulty plugins to interfere with other plugins.
Yes, we tried all of the standard tricks both in dev and test, (test is an exact hw/sw replica of production), as is SOP for any CMS issue logged.
We certainly can sympathize with your desire to rename this (whatever you are wanting to call it) something more politically correct, other than a “bug.” It appears your definition of a bug is more narrow than ours, and we should probably adopt your “softer” stance on “name-calling” of these topics (avoiding the dreaded “B” word) as these gracious plug-in developers are largely unpaid and exceedingly under-appreciated.
Suffice it to say, we greatly appreciate both the plug-in developers and anyone who positively contributes to any of the related forums. And of course, we are a consistent monetary donator to many of the contributors to this as well as various other open-source communities.
So to get any future forum-good-samaritans more up to speed on where we are, and avoid suggesting already tried stuff, we believe we’ve narrowed it down to a database residuals issue from legacy plugins that have somehow created “stealth-conflicts” in migrating to 3.8.1. This is due to the fact that this site has a fairly lengthy history and countless plugins were installed and then uninstalled, but as you know, can unfortunately leave residual data in mySQL.
We’re probably going to stop debugging (oops! I mean de-investigating) this topic because we were able to just reverse-engineer the working plugin code in the CMS console that does essentially the same thing and write our own [shortcode].
Nonetheless, if we do happen to find the issue and related patch / fix on another one of our WP instances, we’ll post the solution here for posterity.
Thanks!
@mr Press
Thank you! If I remove the
_transient_timeout_dw-gtc-list-google_top_content
and_transient_dw-gtc-list-google_top_content
transients every time I make a change to the shortcode, the shortcode works and changes are visible.Thanks again.
If I remove the _transient_timeout_dw-gtc-list-google_top_content and _transient_dw-gtc-list-google_top_content transients every time I make a change to the shortcode, the shortcode works and changes are visible.
Since version 1.5.2 I cannot find these transients anymore in the wp_options table. Anyone knows how I can remove the transients so that the plugin can be configured correctly, instead of keeping the layout it showed the first time upon activation?
- The topic ‘Widget works but shortcode doesn't’ is closed to new replies.