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 trialBram Huisman
7,387 PointsImages not visible --> source code tells me that it's showing my normal posts
Hi guys,
Done everything correct.. i think
<?php
/*
Template Name: portfolio pagina
*/
?>
<?php get_header(); ?>
<section class="row">
<div class="small-12 columns text-center">
<div class="leader">
<!-- BEGIN VAN DE LOOP -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<!-- EINDE VAN DE LOOP -->
</div>
</div>
</section>
<?php
$args = array(
'post-type' => 'portfolio'
);
$query = new WP_Query( $args );
?>
<section class="row no-max pad">
<?php if( $query->have_posts() ) : while( $query->have_posts() ) : $query->the_post(); ?>
<div class="small-6 medium-4 large-3 columns grid-item">
<a href="<?php the_permalink(); ?>"><img /><?php the_post_thumbnail( 'large' ); ?></a>
</div>
<?php endwhile; endif; wp_reset_postdata(); ?>
</section>
<?php get_footer(); ?>
when i inspect elements.. i see this at the place where the images should be:
<a href="http://localhost:8888/wordpress_team_tree_house/hallo-wereld/"><img></a>
What am i doing wrong?
3 Answers
Craig Watson
27,930 PointsHi Bram,
have you got post thumbnails enabled in your functions,php ?
also there a few little tweaks I would be making from the above but first we need to get those images showing.
Are you following along with a course for this theme build?
Craig
Bram Huisman
7,387 PointsHi graig,
I've got a pastebin link of my functions.php: http://pastebin.com/urjcx8qG Yes i am following the wordpress theme development course. Also made a pastbin of my previous code so it's better readable: http://pastebin.com/3EbVpap1
Máté Végh
25,607 PointsHi Bram,
I just ran into the same problem. Check the 28th line of your code:
<?php
$args = array(
'post-type' => 'portfolio'
);
$query = new WP_Query( $args );
?>
You wrote "post_type" with a hyphen instead of an underscore.
"post-type" ≠ "post_type"
Bram Huisman
7,387 PointsBram Huisman
7,387 PointsHi graig,
I've got a pastebin link of my functions.php: http://pastebin.com/urjcx8qG Yes i am following the wordpress theme development course. Also made a pastbin of my previous code so it's better readable: http://pastebin.com/3EbVpap1