Nelo CMS Frontpage showing duplicate graphics for Latest News area

For some reason my Frontpage is showing duplicate graphics (the same graphic from the first post) for all of the news posts listed. Any idea as to why this would be happening?

For those who can view it, here's a screengrab: http://screencast.com/t/ZWM3NmI2ZWE

  • Mason
    • DEV MAN’s Sidekick

    Hiya everyone!

    Sorry this slipped through without a response. Would anyone be able to provide a link to their site so we can see what's going on? That would really help us troubleshoot this for ya as I'm unable to reproduce this problem on my install here.

    Also, a list or screenshot of your "Theme Options" would be great. I'm assuming this appears on the home page when the layout is set to "Blog Homepage" rather than "Custom Homepage"? I've tried it both ways and I still can't get the problem to show up.

    A bit more info, and we'll get this sorted. Thanks! :smiley:

  • Mason
    • DEV MAN’s Sidekick

    Hiya Cheryl,

    Thanks for providing the additional info. I can confirm that this does appear to be a bug in the theme. I'll inform the theme developer. He'll get an updated version (as he's been working on some refreshes for some themes anyway) out ASAP.

    Until then, if you're comfortable making a few edits, you can do this and get it running now. It's pretty simple and both files are located in your theme root.

    Open functions.php
    Scroll to line 37 and add the following:
    if(function_exists('add_theme_support')) {
    add_theme_support('post-thumbnails');
    add_image_size('nelo-thumb', 180, 150, true);
    }

    Next open custom-homepage.php
    On line 35 and line 110 you need to replace this:
    <?php custom_get_post_img ($the_post_id=$the_post_ids, $width='180', $height='150', $size='medium'); ?>
    with this:
    <?php the_post_thumbnail('nelo-thumb'); ?>

    Again, we'll get an update out quickly, but this will fix it for you in the meantime!

    Thanks!

  • cdc19
    • Site Builder, Child of Zeus

    That didn't work too well.

    Created the following error on the front page:

    Fatal error: Call to undefined function the_post_thumbnail() in /home/fowi/public_html/wp-content/themes/wpmu-nelo/custom-homepage.php on line 110

    This error occurred when trying to login to the dash board.

    Sorry, we can't find the content you're looking for at this URL. Please try selecting a menu item from above or to the side of this message to get where you'd like to go.

  • Mason
    • DEV MAN’s Sidekick

    Hiya Cheryl,

    Glad you got the second issue sorted. I'm assuming you placed the first bit of code in your functions.php file? That's where we're defining the function so that it'll work in custom-homepage.php. Please verify that these changes were made and saved correctly.

    Thanks!

  • cdc19
    • Site Builder, Child of Zeus

    Yes, I updated the functions.php file first. I've attached a copy of the custom-homepage.php (renamed as .txt) file with edits that creates the error message.

    Below is the fetch image section from functions.php file.

    ///////////////////////////////////////////////////////////////////////////////
    // fetch post img
    //////////////////////////////////////////////////////////////////////////////
    function custom_get_post_img ($the_post_id='', $width='', $height='', $size='') {
    $detect_post_id = $the_post_id;

    if(function_exists('add_theme_support')) {
    add_theme_support('post-thumbnails');
    add_image_size('nelo-thumb', 180, 150, true);
    }

    $images = get_children(array(
    'post_parent' => $the_post_id,
    'post_type' => 'attachment',
    'numberposts' => 1,
    'post_mime_type' => 'image'));
    if ($images)
    foreach($images as $image) {
    $attachment = wp_get_attachment_image_src($image->ID, $size); ?>

    <div class="alignleft" style="float: left; width: <?php echo $width; ?>px; height: <?php echo $height; ?>px; background: url(<?php echo $attachment[0]; ?>:wink: no-repeat center center; overflow:hidden;"></div>

    <?php
    }
    }

  • Mason
    • DEV MAN’s Sidekick

    Hiya Cheryl,

    The issue is that you've got the new function pasted inside another function. That won't do ;D

    Inside functions.php change what you have above to this:
    ///////////////////////////////////////////////////////////////////////////////
    // fetch post img
    //////////////////////////////////////////////////////////////////////////////
    if(function_exists('add_theme_support')) {
    add_theme_support('post-thumbnails');
    add_image_size('nelo-thumb', 180, 150, true);
    }

    function custom_get_post_img ($the_post_id='', $width='', $height='', $size='') {
    $detect_post_id = $the_post_id;

    $images = get_children(array(
    'post_parent' => $the_post_id,
    'post_type' => 'attachment',
    'numberposts' => 1,
    'post_mime_type' => 'image'));
    if ($images)
    foreach($images as $image) {
    $attachment = wp_get_attachment_image_src($image->ID, $size); ?>

    <div class="alignleft" style="float: left; width: <?php echo $width; ?>px; height: <?php echo $height; ?>px; background: url(<?php echo $attachment[0]; ?>) no-repeat center center; overflow:hidden;"></div>
    <p><?php
    }
    }

    That should do the trick for ya.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.