0

I don't get any errors, but the post images are not displayed on the front page, all other pages displays the images correctly. How can I fix this? Here is the site

The front page is set to display the recent posts.

This is the index.php file

<?php get_header(); ?>

<?php
    // get options
    $pinthis_infinite_scroll = get_option('pbpanel_infinite_scroll');
?>

<section id="content">
    <div class="container fluid">
        <?php if (is_category()) { ?>
            <div class="category-title">
                <div class="container">
                    <h3 class="title-3"><?php single_cat_title(); ?></h3>
                    <?php if (category_description()) { ?><div class="description"><?php echo category_description(); ?></div><?php } ?>
                </div>
            </div>
        <?php } ?>
        <?php if ( have_posts() ) { ?>
        <div class="boxcontainer">
            <?php while ( have_posts() ) { the_post(); ?>
                <?php get_template_part('pinbox', get_post_format()); ?>
            <?php } ?>
        </div>
            <?php
                ob_start();
                posts_nav_link(' ', __('Previous Page', 'pinthis'), __('Next Page', 'pinthis'));
                $pinthis_posts_nav_link = ob_get_clean();
            ?>
            <?php if(strlen($pinthis_posts_nav_link) > 0) { ?>
                <div class="container">
                    <div class="posts-navigation clearfix <?php if ($pinthis_infinite_scroll == 1) { ?>hide<?php } ?>"><?php echo $pinthis_posts_nav_link;  ?></div>
                </div>
            <?php } ?>
        <?php } else { ?>
        <div class="notification-body">
            <p class="notification tcenter"><?php echo __('No posts found.', 'pinthis'); ?></p>
        </div>
        <?php } ?>
    </div>
</section>

<?php get_footer(); ?>

migrated from meta.wordpress.stackexchange.com Jun 29 '15 at 3:47

This question came from our discussion, support, and feature requests site for WordPress developers and administrators.

  • Could you show your code? Because you're getting an undefined src in your images. – Jabel Márquez Jun 29 '15 at 15:52
  • I don't know which one is, it seems to be the same function as for the rest of the pages which displays the images correctly. – Mario M Jul 1 '15 at 21:21
2

Something that generates the image links is broken. You are not getting a valid src attribute in the title tag. The result is:

<p class="thumb">
    <a href="http://paper-backgrounds.com/red-grunge-concrete-texture-3/" title="Red Grunge Concrete Texture">
    <img src="undefined" alt="Red Grunge Concrete Texture" height="132" width="236">
    </a>
</p>

Without that src attribute the image can't load.

As you don't post the code that generated that HTML I can't say exactly how to fix it, but should you post that code (as an edit to the question) I am pretty sure it is an easy fix.

  • I don't know which file have the code for front page display – Mario M Jun 30 '15 at 22:09
  • Nor do I. You will have to dig through your theme. – s_ha_dum Jun 30 '15 at 23:53
  • It is the same function as for the rest of the pages which works, very strange. – Mario M Jul 1 '15 at 21:19
  • @MarioM, then something is wrong with the way that function is written, though (as before) I can't guess at what without seeing the code. – s_ha_dum Jul 20 '15 at 2:41
0

Use This code.

if (wp_get_attachment_url(get_post_thumbnail_id($post->ID))) {
    $thumbnail_url = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
    $data .= '<img alt="blog-img" title="blog-img" class="img-responsive" src="' . $thumbnail_url . '"/>';
}
  • In which php file? My front page is set to display the recent posts. – Mario M Jun 30 '15 at 22:23
  • Please add an explanation to your code – Pieter Goosen Jul 19 '15 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.