WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] all IMAGES are invisible except the post thumbails! (7 posts)

  1. Morocco English
    Member
    Posted 1 year ago #

    I have added the following html section inroder to convert it later to php ....

    <div id="section2_left">
    <h2> Students Posts </h2>
    <img src="students-in-classroom2.jpg" width="146" height="127" />
    <h3> student post title here  </h3>
       </div>

    The problem is that the image doesn't show up when I intergrate this code in my wordpress page while it works properly on Dreamweaver CS5 and when I preview it independently !!

    do you think there could be some php function somewhere that disables images ??

    appreciate ur support !

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Where are you putting this code? It looks like you have a problem with the image path?

  3. Morocco English
    Member
    Posted 1 year ago #

    the images are in the same directory where the file is ...
    I put the code after a div block of some posts

    the following code comes before the new code :

    <div class="item-content">
                            <header>
             <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'noteworthy' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php if(the_title( '', '', false ) !='') the_title(); else _e( 'View Post', 'noteworthy' ); ?></a></h2>
                            </header>
           </div>
    <?php
    						if ( has_post_thumbnail()) : ?>
    
     <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php echo the_post_thumbnail( array( 250, 250) ); ?></a>
    
    <?php else : ?>
    
                                <?php $postimgs =& get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' ) );
    if ( !empty($postimgs) ) :
    								$firstimg = array_shift( $postimgs );
    								$my_image = wp_get_attachment_image( $firstimg->ID, array( 250, 250 ) );
    	?>
    
     <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php echo $my_image; ?></a>
     <?php endif; ?>
    
                            <?php endif; ?>
    </div>
    <?php
    
    				/* end of your output here*/
    		endwhile;
    		endif;
    		wp_reset_postdata(); ?>
    
    		 </div>
    
    		 <div class="cleaner_h10 "> </div>
  4. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Can you post a link to your site? Why are the images in the same file and not in an uploads or media file?

  5. ronangelo
    Member
    Posted 1 year ago #

    <img src="students-in-classroom2.jpg" width="146" height="127" />

    WordPress will assume that the image file is in the main directory not the themes directory. This will work if the image is in the same folder as wp-config.php

    or you can change the source path.

  6. Morocco English
    Member
    Posted 1 year ago #

    this sounds reasonable!
    the path will be like that :
    root/wp-content/themes/mytheme/theimage.jpg

    I will try it

  7. Morocco English
    Member
    Posted 1 year ago #

    It works thank you lot

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.