Upon further investigation I discovered that the issue I’m having is the same as in this post, meaning the links are rendered only when I’m logged in:
https://wordpress.org/support/topic/output-only-works-when-logged-in/
I am very curious as to how you solved the issue in that instance.
Hello. Using the shortcode with do_shortcode()
will absolutely work. “The are no posts in this category” is not a message being output by the plugin, but WordPress or your theme most likely. The plugin is running a WP_query()
loop for the category specified, and if there are not posts in the category that message is likely what you’ll get.
I don’t know of any reason why it would only work while logged in, and unfortunately I don’t recall how I resolved that other support request as it was over two years ago. If you would like me to take a look, please provide an admin login by email it to me here.
Strange. I just emailed you all the login info.
I so appreciate any help you can provide.
I’m checking into this now. I’ll post again when I know something.
I’m having a little trouble navigating your site as it’s in Swedish, and I don’t know Swedish. Can you please give me the URLs to the two pages you have the shortcodes on? There should be a shortcode to display the yearly category links, and a second page that contains the shortcode to display the posts from that year and category.
Yes, this is the page I am using the shortcode on for aw_year_links:
http://sunestrom.se/startsida-ny/
This is the page with the Archives:
http://sunestrom.se/nyheter/
Arkiv = Archive, but I guess that’s kind of obvioous 🙂
I don’t see the shortcodes on that page. Also, there are two shortcodes that need to be used.
The first shortcode is [aw_year_links cat="X" postslug="slug-to-post-or-page"]
, which is used to build and display the year links.
The second shortcode is [aw_show_posts cat="X" readmore="Continue Reading" publishedon="n/j/Y"]
, which is used to display the post content after click a year link.
The plugin will not work correctly without both shortcodes set up appropriately. Each shortcode needs the same category number, and the first shortcode needs the page slug that the second shortcode is on.
I need to take over the two pages you’re in if you would like me to investigate this further.
Sorry, my bad.
The shortcode on http://sunestrom.se/startsida-ny/ is included in the template themes/sunestrom/partials/section/news.php
<?php echo do_shortcode(‘[aw_year_links cat=”26″ postslug=”nyheter”]’); ?>
And yes, feel free to take over the page and make any changes as you see fit.
I just emailed you a question to you. I am able to reproduce your issue with not seeing the links when you are logged in. I can’t get to your theme template file via the WordPress theme editor due to it being in a directory and not root level. Please read and respond to my private email.
Just to close the loop here, after investigating the code in your site, it looks like a bug of some sort in my plugin with $postTypes = get_post_types( '', 'names' );
which is used in the function for both shortcodes the plugin uses. If logged out of WordPress the code is returning an empty array, so no links or posts are “gotten”.
I’ll work on a fix and issue a plugin update soon. I’m marking this as resolved as I resolved it local to your install. Re-open if any other issues arise.
You are a true superhero!
Your commitment to resolve this and the quick turnaround on actually fixing it makes my jaw drop in awe.
I am utterly grateful for your help, you shine like a diamond.
I have updated the plugin to version 1.2.8. This includes the fix to the get_post_types()
issue in this thread.