Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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!

    #1009442

    Hey 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,
    Peter

    #1009447

    Hi!
    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,
    Peter

    #1009838

    Thanks, 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?

    #1010216

    Hi,

    No but you can simply deselect the “Show tag counts” checkbox (widget settings) to hide the count.

    Best regards,
    Peter

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.