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 trial

WordPress How to Build a WordPress Theme Converting Static HTML into WordPress Templates Convert Custom Post Type Listing Template

carriebarnett
carriebarnett
16,732 Points

My images for the homepage_slider_image are not showing up. Haven't been able to get resolved with discussion links.

So I am having the same issue noted previously here in a few discussions. My images for the homepage_slider_image are not loading. I went back and double checked the custom fields video to make sure I had everything set up correctly. I double checked the code for the work.php file. I have an images folder inside my named theme folder with the project image files. What am I missing? Did I miss something in a prior video about the image files? There are no sub folders in my images folder. The descriptions, button color, and title portion of the code work. I did notice in the intro video that shows us the static webpage html, that the css folder has an images folder inside it? Could this have something to do with it? Stumped... could use some direction

3 Answers

Hi Carrie,

Honestly, I think most people would need to see your code in order to help with this. Folder structure will play a large part in this. If you look at dev tools in chrome or firefox does it show a 404 for the images?

carriebarnett
carriebarnett
16,732 Points

I have been so focused on the work.php (my version is called experience.php) and the code there I didn't think to try the developer tools! This did pull up the error :

Uncaught TypeError: $(...).flexslider is not a function - in reference to my theme.js file.

jQuery(document.ready(function($) { $('.flexslider').flexslider(); }); is what I have...

So thank you for pointing me in the right direction. Appears there is either a typo there or jquery incompatibility thing going on. I will dig further.

You're welcome Carrie and try replacing any $ with jQuery directly. This would also guide you towards a solution.

carriebarnett
carriebarnett
16,732 Points

Here is my code. I think it has something to do with either where the files are saved or how to tell Wordpress to point to these files. Can't figure it out.


<?php

/*

Template Name: Experience Page

*/

get_header(); ?>

<div class="grid_12 omega clearfix">

<?php

$args = array(
    'post_type' => 'experience'
);

$the_query = new WP_Query( $args );

?>

<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

<div class="grid_6 spotlight project" style="background-color: <?php the_field( 'background_color' ); ?>">
    <a href="<?php the_permalink(); ?>">
        <img src="<?php the_field( 'homepage_slider_image' ); ?>">
    </a>

    <h4>
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    </h4>
</div>

<?php the_field( 'description' ); ?>

<p>
    <a class="btn blue" href="<?php the_permalink(); ?>" style="background-color: <?php the_field( 'button_color' ); ?>">
        View Project &rarr;
    </a>
</p>

<?php endwhile; else: ?>

<p>There are no posts or pages here</p>

<?php endif; ?>

</div>

<?php get_footer(); ?>

carriebarnett
carriebarnett
16,732 Points

Sorry about the posting format. I have never posted the code on the community ...