WordPress.org

Ready to get started?Download WordPress

Forums

Custom field display on one page (2 posts)

  1. zoomas1
    Member
    Posted 4 months ago #

    In every post i use custom field
    value: post-icon
    key: (img url)

    Writen in single.php loop.

    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
    	<img src="<?php echo get_post_meta($post->ID, 'post-icon', true); ?>" alt="Icon for Post #<?php the_ID(); ?>" />
    </a>

    My goal is to show all post images on one page.
    For image display I use this code:

    <?php query_posts('showposts=10&offset=0'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
    	<img src="<?php echo get_post_meta($post->ID, 'post-icon', true); ?>" alt="Icon for Post #<?php the_ID(); ?>" />
    </a>
    <?php endwhile; endif; ?>

    Ofcourse if I post this code inside page.php it will be displayed on every page, but I want to display these images on a specific page.

  2. zoomas1
    Member
    Posted 4 months ago #

    I only noticed now that I have posted in wrong section. Sorry about that. If a moderator could move this topic, that would be great. Thank you

Reply

You must log in to post.

About this Topic