-
AuthorPosts
-
January 28, 2017 at 12:22 am #739652
Hi,
We need to show private post on a mansory element, currently the post disappear when set to private in the mansory, how can we keep it displayed even when private?
February 1, 2017 at 8:39 am #741071Hi kilimats!
Thank you for using Enfold.
Private posts can only be displayed for users who are currently logged in. Can users login to your site? Please add this in the functions.php file.
add_filter('avia_masonry_entries_query', 'avia_masonry_entries_query_mod', 10, 3); function avia_masonry_entries_query_mod( $query, $params, $masonry ) { $query['post_status'] = array( 'publish', 'private' ); return $query; }
NOTE: This is not going to work unless users are logged in.
Regards,
IsmaelFebruary 1, 2017 at 12:25 pm #741171thanks !
- This reply was modified 7 years, 9 months ago by yingyang.
February 1, 2017 at 1:48 pm #741219Hi!
Please change the code to following one
add_filter('avia_masonry_entries_query', 'avia_masonry_entries_query_mod', 10, 3); function avia_masonry_entries_query_mod( $query, $masonry ) { $query['post_status'] = array( 'publish', 'private' ); return $query; }
Best regards,
YigitFebruary 1, 2017 at 3:44 pm #741297THanks Yigit that did the trick for the masonry, i did notice another issue though, private post don’t show up in the Archive page for logged in members but do show up fine in the masonry and when using the NEXT/PREVIOUS button in the single post page, how do i make it show in the archive as well for member? (admin can see them fine in archive)
February 1, 2017 at 3:51 pm #741300Hey!
Please try adding following code to Functions.php file as well
add_filter('posts_where', 'no_privates'); function no_privates($where) { if( is_admin() ) return $where; global $wpdb; return " $where AND {$wpdb->posts}.post_status != 'private' "; }
If that does not help, please post temporary admin logins in private content field and link to your masonry page and archive page
Regards,
YigitFebruary 1, 2017 at 4:02 pm #741310that code didnt work
- This reply was modified 7 years, 9 months ago by yingyang.
February 2, 2017 at 6:13 am #741556any luck?
February 2, 2017 at 6:23 am #741560Hi!
The filter is not working on archive pages because it’s using the postslider element. Please replace the code with:
add_filter('avia_post_slide_query', 'avia_post_slide_query_mod', 10, 2); function avia_post_slide_query_mod( $query, $params ) { $query['post_status'] = array( 'publish', 'private' ); return $query; } add_filter('avia_masonry_entries_query', 'avia_masonry_entries_query_mod', 10, 2); function avia_masonry_entries_query_mod( $query, $params ) { $query['post_status'] = array( 'publish', 'private' ); return $query; }
If this filter is not working, you need to modify the archive.php file, look for the custom query parameter.
'custom_query' => array( 'post__in'=>$post_ids, 'post_type'=>get_post_types() )
Regards,
IsmaelFebruary 2, 2017 at 8:26 am #741619what do i change in the archive.php? confused thanks
- This reply was modified 7 years, 9 months ago by yingyang.
February 2, 2017 at 9:16 am #741648Hi!
Did you try the filter first? In the archive.php file, look for the line mentioned above then replace it with:
'custom_query' => array( 'post__in'=>$post_ids, 'post_type'=>get_post_types(), 'post_status'=> array( 'publish', 'private' ) )
UPDATE: Remove the filter that we suggested previously then copy the latest filter above. The error occurs because the functions are duplicated.
Best regards,
IsmaelFebruary 2, 2017 at 9:25 am #741649just tried and no luck, let me know if you see something wrong
February 3, 2017 at 8:35 am #742237any idea?
February 4, 2017 at 5:49 am #742650Hi!
UPDATE: Remove the filter that we suggested previously then copy the latest filter above. The error occurs because the functions are duplicated.
Best regards,
IsmaelFebruary 4, 2017 at 8:07 am #742696no luck,
February 6, 2017 at 2:00 am #743096Hi!
I’m sorry but you’re not following our instructions. Previously, we suggested a filter in the functions.php file, please remove that one and then add the following filter.
add_filter('avia_post_slide_query', 'avia_post_slide_query_mod', 10, 2); function avia_post_slide_query_mod( $query, $params ) { $query['post_status'] = array( 'publish', 'private' ); return $query; } add_filter('avia_masonry_entries_query', 'avia_masonry_entries_query_mod', 10, 2); function avia_masonry_entries_query_mod( $query, $params ) { $query['post_status'] = array( 'publish', 'private' ); return $query; }
Regards,
IsmaelFebruary 6, 2017 at 8:48 am #743207that worked ! sorry about that, got mixed up, thank you very much !
-
AuthorPosts
- The topic ‘SHow PRIVATE post on Mansory?’ is closed to new replies.