-
AuthorPosts
-
September 13, 2018 at 3:12 pm #1009433
Hi,
my problem is this:
Even when I am logged in private posts are not shown in a widget where I created a tag-cloud.
I had similar problems showing private pages in masonry and magazine, but Peter managed to deliver a code which could solve the problem partially (check this thread).I have a clean install of enfold with no plugins or addons installed. Please check the element on the bottom of the homepage – it’s a tag cloud, but only tags from the public entries are shown, even when you are logged in.
I attach the login-data as private content. Feel free to poke around in the installation, at it is for testing purposes only. You might also change the functions.php for the child-theme. Also you could find the solution from Peter I have mentioned above if this is helpful for you.
Thanks in advance!
September 13, 2018 at 3:26 pm #1009442Hey jobalzer!
I’m sorry but afaik there’s no solution. The default wordpress tag widget simply doesn’t display private posts (see https://en.forums.wordpress.com/topic/why-no-tags-from-private-posts-in-tag-cloud-when-i-logged-in/ and https://www.quora.com/Is-there-a-way-of-displaying-private-pages-in-the-wordpress-tag-cloud-when-users-are-logged-in ). This is not a limitation of Enfold but a wordpress core limitation. Also the wp_tag_cloud() function ( https://codex.wordpress.org/Function_Reference/wp_tag_cloud ) does not offer an option/parameter to include/exclude private posts.
There’re three possible solutions:
1) Search for a third party plugin here: https://wordpress.org/plugins/search/tag+cloud/ which supports tags of private posts
2) Create a “tag widget” manually and hardcode all tag links.
3) Hire someone to create a tag widget which supports private posts for you.Best regards,
PeterSeptember 13, 2018 at 3:36 pm #1009447Hi!
An user here: https://stackoverflow.com/questions/6269137/wordpress-force-wp-tag-cloud-to-display-empty-categories suggested the args maybe support the “hide_empty” => false” parameter (which I haven’t tested). If this is true you can use this code to include the tags of private posts in the tag cloud – you can add it to the child theme functions.php://Register tag cloud filter callback add_filter('widget_tag_cloud_args', 'avia_tag_widget_hide_empty'); function avia_tag_widget_hide_empty($args){ //Check if taxonomy option inside widget is set to tags if(isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag'){ $args['hide_empty'] = false; } return $args; }
I’ve not tested it and I’m not sure if it will work…
Best regards,
PeterSeptember 14, 2018 at 9:39 am #1009838Thanks, Peter!
Unfortunately this does not work 100% correctly. Now the tags are shown, but the count of entries is counting only public entries.
So now on the homepage we see “schlagwort3 (0)”, and if we click on the tag schlagwort3 we get 2 entries. So it should be “schlagwort3 (2)”Do you have any idea how to solve this?
September 15, 2018 at 7:08 pm #1010216Hi,
No but you can simply deselect the “Show tag counts” checkbox (widget settings) to hide the count.
Best regards,
Peter -
AuthorPosts
- You must be logged in to reply to this topic.