WordPress.org

Support

Support » Your WordPress » Custom field display on one page

Custom field display on one page

  • 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.

Viewing 1 replies (of 1 total)
  • 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

Viewing 1 replies (of 1 total)
  • The topic ‘Custom field display on one page’ is closed to new replies.
Skip to toolbar