• Hi,

    WARNING: This website contains adults materials.

    I am having an issue where the feature images does not show up. I’m still a novice when it comes to php. You can go to this page and I’ll try to explain.

    URL: http://thefnlab.com/gasm/books/testing-book

    The content section below the nav is composed of 2 sections, the LEFT hand side (which display the feature image) and the RIGHT hand side (which display the text).

    For some strange reasons, newly created pages DOES NOT display the feature image on the LEFT hand side. This page include “testing book”. I have checked the database and the LEFT hand side file was created successfully as seen here: http://thefnlab.com/gasm/books/testing-book/testimage

    While old pages which was already created awhile back do display the feature image (as seen in the other 4 books).

    If you view source you will see:
    <div id=”leftcolumn” style=”css here”> FEATURE IMAGE </div>
    <div id=”rightcolumn” style=”css here”> CONTENT AREA </div>

    I am having a hard time trying to figure out why. Here is the snippets of codes which generate these 2 divs. However ONLY the “leftcolumn” div needs help (but I am posting the “rightcolumn” div codes as well in case it helps in with the debugging.

    Any help would be greatly appreciated. If you need further info, please let me know.

    <?php } if (is_page(array('toys', 'accessories', 'books', 'dvds'))
    				|| $parent->post_name == 'toys' || $parent->post_name == 'accessories' || $parent->post_name == 'books'
    				|| $parent->post_name == 'dvds') { ?>
    			<div id="leftcolumn" style="width: 530px; border-right: none; padding-right: 0; margin-right: 0;">
    
    				<?php
    					$pageId = $post->ID;
    					if (is_page(array('toys', 'accessories', 'dvds', 'books'))) {
    						$children = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'menu_order', 'sort_order' => 'asc' ) );
    						foreach( $children as $page ) {
    							$pageId = $page->ID;
    							break;
    						}
    					}
    					$args = array(
    						'post_type' => 'attachment',
    						'numberposts' => -1,
    						'post_status' => null,
    						'post_parent' => $pageId
    					);
    
    					$attachments = get_posts( $args );
    					if ( $attachments ) {
    						foreach ( $attachments as $attachment ) {
    							if($attachment->ID != get_post_thumbnail_id( $pageId )) {
    								echo wp_get_attachment_image( $attachment->ID, 'full' );
    							}
    						}
    					}
    
    				?>
    			</div>
    			<div id="rightcolumn" style="width: 380px; overflow: auto; margin-left: 10px;">
    				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    				<?php
    					if (is_page(array('toys', 'accessories', 'deals', 'books'))) {
    						$children = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'menu_order', 'sort_order' => 'asc' ) );
    						foreach( $children as $page ) {
    							$content = $page->post_content;
    							if ( ! $content ) // Check for empty page
    								continue;
    							$content = apply_filters( 'the_content', $content );
    							echo '<div id="rightcolumntitle" style="color: #5e99b7; width: 370px;">'.$page->post_title.'</div>';
    							echo '<div id="rightcolumncontent" style="width: 370px;">'.$content.'</div>';
    							break;
    						}
    					} else { ?>
    					<div id="rightcolumntitle" style="color: #5e99b7; width: 370px;"><?php the_title(); ?></div>
    					<div id="rightcolumncontent" style="width: 370px;">
    						<?php the_content(); ?>
    					</div><!-- #rightcolumn-content -->
    				<?php } ?>
    				</div><!-- #post-## -->
    			</div><!-- #rightcolumn -->

    Thank you kindly.

  • The topic ‘Feature Images did not display’ is closed to new replies.