Tagged: blog masonry
-
AuthorPosts
-
November 3, 2022 at 3:14 pm #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,
MarinaNovember 7, 2022 at 7:23 am #1371605Hey 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,
IsmaelNovember 8, 2022 at 7:13 pm #1371800Hello,
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,
MarinaNovember 9, 2022 at 5:33 am #1371854Hi,
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,
IsmaelNovember 9, 2022 at 11:31 pm #1372006Hello,
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,
MarinaNovember 15, 2022 at 8:36 am #1372611Hi,
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,
IsmaelNovember 18, 2022 at 9:52 pm #1373157Hello,
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,
MarinaDecember 2, 2022 at 9:00 am #1374734Hi,
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,
IsmaelDecember 3, 2022 at 2:35 pm #1374905Hi,
However, the private posts are not displayed for the logged in users on the Blog page. Please see the links.
Best regards,
MarinaDecember 8, 2022 at 9:36 am #1375486Hi,
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,
IsmaelDecember 8, 2022 at 10:25 pm #1375604Hello,
This solves my issue, thank you for your help, you can close the ticket.
Best regards,
MarinaDecember 9, 2022 at 11:46 am #1375652Hi Marina,
I’m glad that Ismael could help you :)
Thanks for using Enfold and have a great weekend!Best regards,
Nikko -
AuthorPosts
- The topic ‘Display private posts in blog masonry for admin’ is closed to new replies.