• Resolved jasjoerii

    (@jasjoerii)


    Hi guys,

    I’ve got a problem with using Custom Fields on a page. I’d like to show an image using a Custom field, but I can’t get it to work. Do I have to do anything differtent then when I’m using it on a post? Can someone please help?

    Link: https://www.lemke.jasites.nl/?page_id=9 (yes i’m dutch)

    This is the code I use:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <div id="subimages">
    
                <img src="<?php get_post_meta($post->ID, 'img1', true); ?>" alt="" />
    
                <img src="<?php get_post_meta($post->ID, 'img2', true); ?>" alt="" />
    
            </div>

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

    (@jasjoerii)

    I get it. I added “echo”

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <div id="subimages">
    
                <img src="<?php echo get_post_meta($post->ID, 'img1', true); ?>" alt="" />
    
                <img src="<?php echo get_post_meta($post->ID, 'img2', true); ?>" alt="" />
    
            </div>
Viewing 1 replies (of 1 total)
  • The topic ‘Use Custom Fields on Pages?’ is closed to new replies.