Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialEric Ridolfi
19,417 PointsNot all portfolio pieces are showing on home page
I have 13 portfolio pieces and only 10 of them are showing on the home page. Do I need to code something or is there a setting that I missed somewhere?
4 Answers
Rich Bagley
25,869 PointsHi Eric,
I don't think there is a limit set on these from the tutorial.
One thing to check would be that all 13 portfolio pieces have a featured image set against them.
EDIT:
If you haven't reached that video yet I've just had a thought on what it could be.
The default posts per page is set to 10.
Can you check Settings > Reading to see what number of posts the Blog pages show at most is set to please? If it is set to 10 can you increase it to say 15 and see if that makes a difference please? You should be able to revert this back when you reach the later videos.
-Rich
Eric Ridolfi
19,417 PointsHi Rich,
All of the images have featured images set. When I add a new piece it boots the tenth piece out so there is always 10 images. That's why I was wondering if there was a setting or something I missed.
Rich Bagley
25,869 PointsHi Eric,
Can you post your code please?
Thanks
-Rich
Rich Bagley
25,869 PointsHi Eric,
One other thing to check in the meantime would be content-portfolio.php (if you're at that stage). In a later video this includes:
$num_posts = ( is_front_page() ) ? 4 : -1;
This will mean that on the home page 4 portfolio pieces show but normally all pieces will appear.
It may be related to this.
-Rich
Eric Ridolfi
19,417 PointsHi Rich,
I did not make it to the video with the content-portfolio.php file yet.
Here is my page_portfolio.php:
<?php get_header(); ?>
<!-- Content Wrapper -->
<div class="content-wrapper large-12 columns clearfix" data-equalizer-watch>
<?php
$args = array(
'post_type' => 'portfolio'
);
$query = new WP_Query($args);
?>
<!-- Gallery Thumbs -->
<div id="effect-1" class="row small-collapse medium-collapse large-collapse full-width img-hover" data-equalizer-watch>
<?php if ($query->have_posts() ) : while ($query->have_posts() ) : $query->the_post(); ?>
<?php
$image_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
?>
<div class="img small-12 medium-6 large-3 columns left hover">
<a href="<?php echo $image_url; ?>" class="fresco"><?php the_post_thumbnail('thumbnail'); ?></a>
<div class="overlay">
<span class="expand"><?php the_title(); ?></span>
<a class="close-overlay hide">x</a>
</div>
</div>
<?php endwhile; endif; wp_reset_postdata(); ?>
</div>
<!-- End Gallery Thumbs -->
<?php get_footer(); ?>
I created my own html based off of foundation.
Rich Bagley
25,869 PointsHi Eric,
Just updated my original answer above based on your feedback.
-Rich
Eric Ridolfi
19,417 PointsHi Rich,
The amount of blog post setting is it!
Thank you very much for taking the time to help.
Rich Bagley
25,869 PointsNo problem, I should have thought of that earlier really but narrowing the stage you were at in the course helped :)
-Rich
Paul Roberts
7,928 PointsPaul Roberts
7,928 PointsHad this exact question and saw your answer regarding checking a featured image set against them! D'oh! Thanks for accidentally helping me out :D
Rich Bagley
25,869 PointsRich Bagley
25,869 PointsHaha no problem. Glad I could accidentally help :)
-Rich