• Resolved hcvitto

    (@hcvitto)


    i’m trying to use custom field to retrieve info about img to display in my pages (not in posts).
    i have this template

    <?php get_header(); ?>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div id=”content” id=”post-<?php the_ID(); ?>”>

    <?php $id = $post->ID; ?>

    <?php $img = get_post_meta($id, ‘immagine’); ?>

    <img src=”path-to-image-folder/<?php echo $img; ?>.jpg” />

    <?php $content = get_the_content(); ?>

    <?php echo $content; ?>
    </div>
    <?php endwhile; endif; ?>

    <?php get_footer(); ?>

    but what i get is just ( header and footer show fine )

    <div id=”content” id=”post-144″>
    <img src=”path-to-image-folder/.jpg” />
    </div>

    i put content both in the page and in the custom field ‘immagine’ but nothing works and the content doesn’t even show.

    if i use the_content() insted of get_the_content(); it’s even worse!
    all i got is the broken img and this html code!!

    <p class=”attachment”><img src=”path-to-image-folder/prk-300×51.jpg” width=”300″ height=”51″ class=”attachment-medium” alt=”” /></p>

    i used the EasyPermGals and then i deactivate it (i read somewhere that some plugin use to cache stuff in wp db)

    any help? thanks
    vitto

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘custom field help’ is closed to new replies.