Forum Replies Created

Viewing 1 replies (of 1 total)
  • To display image and text in a post (single.php or index.php)

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php $image-variable = get_post_meta($post->ID, 'image-variable', true); ?>
    <h1><?php the_title(); ?></h1>
    <?php the_content(); ?>
    <?php echo get_image('image-variable'); ?>
    <?php echo get('text-variable'); ?>
    <?php endwhile; endif; ?>

    Just change the “image-variable” in the three places that’s within the loop. If you have more images just add another <?php $image-variable = get_post_meta($post->ID, 'image-variable', true); ?> line with it’s variable name and add its <?php echo get_image('image-variable'); ?>.

    If you want to put in more text fields, then add the <?php echo get('text-variable'); ?> were you want them to in the code. Remember to change the variable.

    These have to be within a loop:

    <?php echo get_image('image-variable'); ?>
    <?php echo get('text-variable'); ?>

    I hope I was clear enough. 🙂

Viewing 1 replies (of 1 total)