Skip to:
Content
Pages
Categories
Search
Top
Bottom

Post-type powered custom group front page

  • Avatar of Matt Edminster
    Matt Edminster
    Participant

    @chiinook

    Using a tutorial offered by @modemlooper back in ’10 I set up a custom frontpage for our organization’s bp groups which draws from pages with the same name as the group.

    So the group ‘bicycles’ populates its frontpage with content from the page ‘bicycles’ (which is a child page of ‘groups’).

    I am now upgrading the site to the Canvas theme by woothemes and would like to use their built-in portfolio custom post type with its nice gallery feature to do the same thing. Following the old rules, I set up things just as before. Then I re-registered the ‘portfolio’ post type as ‘groups’ and copied the single-portfolio.php file content into my groups front.php. Then a created a bunch of portfolio items with names matching existing bp groups.

    The result is that instead of displaying the custom-post-type content, the group front page displays the content of the group again. I assume this is happening because of the way the new theme compatibility hijacks the_content(). That would mean that when it sees the_content() in front.php, it loads the group again rather than the post content.

    Am I on the right track? Any suggestions on how to either fix my problem or take a new approach altogether?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    This is way beyond the scope of this help forum. Have you tried creating a loop that pulls the custom post type directly?

    $args = array( 'post_type' => 'product', 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    	the_title();
    	echo '<div class="entry-content">';
    	the_content();
    	echo '</div>';
    endwhile;
    Avatar of Matt Edminster
    Matt Edminster
    Participant

    @chiinook

    Thanks for the response. That’s basically what I have set up, yeah.

    Sorry for taking up this up in the wrong place. Any suggestions where I should turn?

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    It’s just not a core issue with BuddyPress and dives into the customization of BP. Unless someone has specifically needed to do this in the past no one will be likely to help you.

    I would either put out a call to hire if you can not get it to work or possible post at woo or try something like http://stackoverflow.com

    It really shouldn’t be that hard. Create a cpt loop on the front page of the group and then where you call the post type return the group name that matches the cpt

    $cpt = some code to get the group name
    $args = array( 'post_type' => $cpt, 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    	the_title();
    	echo '<div class="entry-content">';
    	the_content();
    	echo '</div>';
    endwhile;
    Avatar of Matt Edminster
    Matt Edminster
    Participant

    @chiinook

    thanks … I’ll see where I can take it from here

    Avatar of focallocal
    focallocal
    Participant

    @focallocal

    this is exactly what i’m looking for, but i’m a little afraid of the amount of coding involved in the guide by @modemlooper if it caused any compatibility issues in the future i doubt i would be able to locate the issue and fix it as my understanding of code is not great right now.

    does anyone know of a plugin that does the same as this?

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.