Tagged: 

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1371244

    Hello,

    I would like to display private posts (link1) on the blog masonry page (link2) for admins. Now the blog page is private as well, so to see the links please use the credentials from the Private Data section. In the future the blog page will become public. If I use the next solution: https://kriesi.at/support/topic/private-posts-not-shown-in-masonry-or-magazine/, then the portfolio masonry images disappear from, for example, link3.

    Thank you,
    Marina

    #1371605

    Hey Marina,

    Thank you for the inquiry.

    You can remove this condition from the filter to display the posts for non-logged-in users.

    if(is_user_logged_in()) 
    

    Let us know if this helps.

    Best regards,
    Ismael

    #1371800

    Hello,

    I think, you did not understand the request correctly. I would like to display private posts on the blog page for admin: now they are not displayed for anybody.

    Best regards,
    Marina

    #1371854

    Hi,

    Thank you for the clarification.

    Looks like every posts and pages in the site are displaying in the blog page’s masonry element now instead of the intended private post. Have you tried disabling the plugins temporarily?

    We added the query filter again in the functions.php file but all items are still displaying in the masonry element. This might mean that something else is causing the issue such as a custom script or a third party plugin.

    Best regards,
    Ismael

    #1372006

    Hello,

    The following code displays private posts on Blog page (link1) as needed, however is causes the Masonry Galleries disappear on the portfolio pages (link2). Is it possible to customize the code so that the galleries stay visible?

    add_filter('avia_masonry_entries_query', 'avia_custom_query_extension', 10, 2);
    
    function avia_custom_query_extension( $query, $params ) 
    {
    	if(is_user_logged_in()) $query['post_status'] = array('publish','private');
    	return $query;
    }

    Best regards,
    Marina

    #1372611

    Hi,

    Sorry for the delay. The private posts are displaying correctly in the blog page when we checked the site again. How did you fix the issue?

    Best regards,
    Ismael

    #1373157

    Hello,

    The private posts are displayed if there is at least one public post. However, the mentioned code makes masonry galleries disappear. Please see the link1 (how it should be) and link2 (how it is when the code to display private posts is applied).

    Best regards,
    Marina

    #1374734

    Hi,

    Sorry for the delay. Looks like you are using the Masonry Gallery. The gallery items or attachments do not display when the filter above is added because attachments cannot be set as private. Please note that private posts will automatically display when you’re logged in, so you don’t have to add the filter above.

    Best regards,
    Ismael

    #1374905

    Hi,

    However, the private posts are not displayed for the logged in users on the Blog page. Please see the links.

    Best regards,
    Marina

    #1375486

    Hi,

    Looks like the masonry element doesn’t include private posts by default. Sorry about that. We added the filter again and modified the condition so that it is only applied in the blog page.

    // Display private posts on Blog page for logged in users
    add_filter('avia_masonry_entries_query', 'avia_custom_query_extension', 10, 2);
    
    function avia_custom_query_extension( $query, $params ) 
    {
    	if(is_user_logged_in() && is_page(66)) $query['post_status'] = array('publish','private');
    	return $query;
    }
    

    If you want to apply the filter to other pages, you can modify the value of the is_page function in the filter above. The conditional function accepts an array of page ID or title.

    // https://developer.wordpress.org/reference/functions/is_page/

    For the related posts section, you will have to modify the enfold/includes/related-posts.php directly. Unfortunately, this is beyond the scope of support.

    Best regards,
    Ismael

    #1375604

    Hello,

    This solves my issue, thank you for your help, you can close the ticket.

    Best regards,
    Marina

    #1375652

    Hi Marina,

    I’m glad that Ismael could help you :)
    Thanks for using Enfold and have a great weekend!

    Best regards,
    Nikko

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Display private posts in blog masonry for admin’ is closed to new replies.