Inserting Jetpack portfolio
-
Hey hey!
Sooooo I’m working on a new portfolio site powered with Jetpack. The template has a “Default” page template and a “Portfolio” page template. What the “Portfolio” page does is insert your standard content then adds an additional portfolio feed under the content.
I want to replicate this inserted portfolio feed at the bottom of all my single post pages, “content-portfolio-single.php”
What I have done is copy what I think is the proper code to call the posts and inserted it after the single post content. However it doesn’t fully work. It inserts a bunch of white space and links to the content but no images.
This is the code I have inserted after the post content…
<?php if ( get_query_var( 'paged' ) ) : $paged = get_query_var( 'paged' ); elseif ( get_query_var( 'page' ) ) : $paged = get_query_var( 'page' ); else : $paged = 1; endif; $posts_per_page = get_option( 'jetpack_portfolio_posts_per_page', '11' ); $args = array( 'post_type' => 'jetpack-portfolio', 'posts_per_page' => $posts_per_page, 'paged' => $paged, '1' => $paged, 'orderby' => 'rand' ); $project_query = new WP_Query ( $args ); if ( post_type_exists( 'jetpack-portfolio' ) && $project_query -> have_posts() ) : ?> <div class="portfolio-wrapper"> <?php /* Start the Loop */ ?> <?php while ( $project_query -> have_posts() ) : $project_query -> the_post(); ?> <?php get_template_part( 'content', 'portfolio' ); ?> <?php endwhile; ?> </div><!-- .portfolio-wrapper --> <?php illustratr_paging_nav( $project_query->max_num_pages ); wp_reset_postdata(); ?> <?php else : ?> <?php endif; ?>
I’m guessing somewhere in the query it is getting thrown off because it is a random page and not the “Portfolio” or “Home” page… I dunnno. I’m confused.
- The topic ‘Inserting Jetpack portfolio’ is closed to new replies.