WordPress.org

Ready to get started?Download WordPress

Forums

Using images in custom fields (1 post)

  1. cmd225
    Member
    Posted 1 year ago #

    I am attempting to change the theme to call these sidebar images from a custom field titled "sidebar" instead of from the featured image of each post. I am new at this and any help would be greatly appreciated.

    <div id="inner_sidebar">
    				<?php
    					$mypages = get_pages( array( 'child_of' => 9, 'sort_column' => 'post_title', 'sort_order' => 'asc' ) );
    
    					foreach( $mypages as $page ) {
    						$content = $page->post_content;
    						if ( ! $content ) // Check for empty page
    							continue;
    
    						$content = apply_filters( 'the_content', $content );
    					?>
    					<div class="item city">
    						<?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
    						<a href="<?php echo get_page_link( $page->ID ); ?>"><img class="frame" src="<?php bloginfo('url'); ?>/images/city_image_frame_thumb.png" alt="" /></a>
    						<a class="title" href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a>					</div>

Topic Closed

This topic has been closed to new replies.

About this Topic