Skip to:
Content
Pages
Categories
Search
Top
Bottom

Use front.php with custom posts


  • brianhackett
    Participant

    @brianhackett

    Hi
    I have front.php setup and a home tab on my users profiles .I have a custom posts setup and I want to add a custom post the home tab to each member profile and assign the post by author. I can pull in the custom post content into the home tab by add this code to front.php

    <?php 
     
    //My custom post type name in the arguments
     
    $args = array('post_type' => 'bios');
     
    //Define the loop based on arguments
     
    $loop = new WP_Query( $args );
     
    //Display the contents
     
    while ( $loop->have_posts() ) : $loop->the_post();
    ?>
    <h1 class="entry-title"><?php the_title(); ?></h1>
    <div class="entry-content">
    <?php the_content(); ?>
    </div>
    <?php endwhile;?>

    What I need help with is adding the post author to the loop so only the custom post created by that author shows on the home tab for that user . I think you could add something like $profileUserID = bp_displayed_user_id(); but im not sure about the php syntax to do this

    Any help is greatly appreciated
    Thanks
    Brian

Viewing 1 replies (of 1 total)

  • brianhackett
    Participant

    @brianhackett

    ok i have found a way to do this
    I added this ot the first part of the code

    $profileUserID = bp_displayed_user_id();
    $args = array('post_type' => 'social_feed', 'bios' => $profileUserID);
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar