Query pages on profile
-
Hello everyone,
I have the following code added to my functions.php// Buddy Press Func. function my_redirect_canonical($redirect_url, $requested_url) { // If on a BuddyPress page, just go to the requested URL: no redirects! if ( bp_is_members_component() || bp_is_user() ) { return $requested_url; } else { return $redirect_url; } } add_filter('redirect_canonical', 'my_redirect_canonical', 10, 2); // Buddy Press Funktionen Posts im Profil add_action( 'bp_setup_nav', 'add_profileposts_tab', 100 ); function add_profileposts_tab() { global $bp; bp_core_new_nav_item( array( 'name' => 'Submissions', 'slug' => 'submissions', 'screen_function' => 'bp_postsonprofile', 'default_subnav_slug' => 'Submissions', 'position' => 250 ) ); } // show feedback when 'Posts' tab is clicked function bp_postsonprofile() { add_action( 'bp_template_content', 'profile_screen_posts_show' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } function profile_screen_posts_show() { query_posts( 'author=' . bp_displayed_user_id() ); if ( have_posts() ) : get_template_part( 'author-user' ); else:?> <div id="message" class="info"> <p><?php bp_displayed_user_username(); ?> You don't have any submissions. </p> </div> <?php endif; ?> <?php } //POSTS ON PROFILE ENDS HERE
My problem is this query works for posts only, I want it to make it show current user owned pages instead of posts, but my coding skills are terribly bad, and I tried all kind of things, reading through wp guides etc. but i just suck at coding. Does anyone have a min to take a look at the code and tell me what i need to change to get it to show pages instead of posts.
Thanks 🙂
- You must be logged in to reply to this topic.