Okay
  Public Ticket #1385043
REcent posts
Closed

Comments

  • joris started the conversation

    Is it normal or a bug that categories of  private posts are not  displayed in 'orion recent posts' . Those categories are not displayed in the properties.


    thanks

    Joris

  •  104
    OrionThemes replied

    Hi Joris,

    This is actually a WordPress thing. 

    For retrieving the category list, our widget uses WordPress native function get_categories(). This function returns only the categories in use, with public posts.

    Kind regards,
    Andrej

  • joris replied

    Hi

    Thanks for the fast reply. Any knowledge of a workaround. Specific widgets? Tried some of the most popular ones but no luck.

    Greetz

  •  104
    OrionThemes replied

    There is a workaround, it requires getting hands dirty with code...
    I found this suggestion on stackoverflow: https://stackoverflow.com/questions/16189650/cant-display-wordpress-categories-which-are-assigned-to-a-private-post

    Not sure if this helps, though.

    Andrej

  • joris replied

    thanks! I'm a .net guy and not familiar with this. In which file should i find it, to adapt it? It's not mentionned?

    (Know that it's beyond orionthemes ... ) I really appreciate this help.

    for me it would be like this to have it displayed. I hope (!) it wil display the hierarchical items beneath my 'nieuws-intern' category...

    <?php global $wpdb; $post_type_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'nieuws-intern' AND post_status = 'private'"); if($post_type_ids){ $post_type_cats = wp_get_object_terms( $post_type_ids, 'category',array('fields' => 'ids') ); if($post_type_cats){ $post_type_cats = array_unique($post_type_cats); $post_type_cats = implode(',',$post_type_cats); wp_list_categories('include='.$post_type_cats); } }
    ?>

  •  104
    OrionThemes replied

    The file to tweek is widgets/so-widgets/orion-recent-posts-carousel/orion-recent-posts-carousel.php 
    The get_categories() part is in line 12. 

    But I also need to warn you, when you update the theme to a newer version, this files will be overwritten and you will need to apply the changes again.

    Andrej