• I have created a site using WP as a CMS and have created a custom news page.

    I have also created banner ads using custom fields which pull in images and text.

    These banners work on all pages except the custom news page. Can anyone give me any advice on this?

    This is the code pulling in the left column to display the list of links

    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
       <ul>
          <li><h3 class="liststories"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3></li>
       </ul>
    
       <?php endwhile ?>
       <?php endif; ?>

    This on the right hand column to display the banner ads

    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
       <?php if (get_post_meta($post->ID, 'banner_image', true)) { ?>
    
       <img src="/wp-content/uploads/<?php echo get_post_meta($post->ID, 'banner_image', true); ?>" alt="<?php echo get_post_meta($post->ID, 'image_alt', true); ?>" />
       <p><?php echo get_post_meta($post->ID, 'banner_text', true); ?></p>
    
       <?php } ?>
       <?php endwhile; else: ?>

    And this code in the middle column to display the posts.

    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    
    <h4><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4>
    
    <small>on <?php the_time('M d'); ?> in <?php the_category(', '); ?></small>
    
    <?php the_excerpt('Read More'); ?>
    
    <hr />
    
    <?php endwhile ?>	
    
    <div id="posts_navigation">
    
    <?php previous_posts_link(); ?>		
    
    <?php next_posts_link(); ?>
    
    </div>
    
    <?php else : ?>
    
    <h2>Not Found</h2>
    
    <p>Sorry, but the page you are looking for cannot be found.</p>
    
    <?php endif; ?>

Viewing 1 replies (of 1 total)
  • Thread Starter lilmisstee

    (@lilmisstee)

    Im thinking this is to do with the fact that this page is set to be the blog page and therefore doesnt use the page content from the WP Admin.

    Can anyone advise me of a way around this?

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Fields on a Custom News Page’ is closed to new replies.