Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1190086
    cohen611
    Participant

    Hi,

    I have a custom page where users can go and see their own posts. I realize support for X does not include custom code, but I was wondering if this is something that can be done with either Essential Grid or The Grid. To clarify, I want to display only the current logged in user’s posts on a custom page in a grid format.

    Thanks

    #1190200
    Rad
    Moderator

    Hi there,

    Thanks for writing in.

    That’s possible with Essential Grid plus custom query, like from here https://www.themepunch.com/faq/advanced-additional-parameters/

    Then simply alter the parameters present at $query variable.

    1. Get current user information ( https://codex.wordpress.org/Function_Reference/wp_get_current_user ), like this

    $current_user = wp_get_current_user();
    $author_ID = $current_user->ID;

    2. Then add author parameter on $query like this

    if($grid_id == YOUR_GRID_ID) {
    
     $query['author'] = $author_ID;
    
    }

    Hope this helps.

    #1191219
    cohen611
    Participant

    Thank you so much! It worked like a charm! Have a wonderful day ^_^

    #1191497
    Darshana
    Moderator

    Glad we were able to help 🙂

  • <script> jQuery(function($){ $("#no-reply-1190086 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>