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

    #741071

    Hi 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,
    Ismael

    #741171

    thanks !

    • This reply was modified 7 years, 3 months ago by yingyang.
    #741219

    Hi!

    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,
    Yigit

    #741297

    THanks 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)

    #741300

    Hey!

    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,
    Yigit

    #741310

    that code didnt work

    • This reply was modified 7 years, 3 months ago by yingyang.
    #741556

    any luck?

    #741560

    Hi!

    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,
    Ismael

    #741619

    what do i change in the archive.php? confused thanks

    • This reply was modified 7 years, 3 months ago by yingyang.
    #741648

    Hi!

    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,
    Ismael

    #741649

    just tried and no luck, let me know if you see something wrong

    #742237

    any idea?

    #742650

    Hi!

    UPDATE: Remove the filter that we suggested previously then copy the latest filter above. The error occurs because the functions are duplicated.

    Best regards,
    Ismael

    #742696

    no luck,

    #743096

    Hi!

    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,
    Ismael

    #743207

    that worked ! sorry about that, got mixed up, thank you very much !

Viewing 17 posts - 1 through 17 (of 17 total)
  • The topic ‘SHow PRIVATE post on Mansory?’ is closed to new replies.