• Resolved adejones

    (@adejones)


    I have a post with 4 custom fields, and I am using the_meta() to display these.
    I want to add an image to the list items, but a different image for each item
    eg. key “Client” will have a small image of a person, key “Date” will have an image of a calendar…

    How is this possible please?

Viewing 8 replies - 1 through 8 (of 8 total)
  • can you give the link to your demo so that it will be more clear to help you sort out your problem

    Thread Starter adejones

    (@adejones)

    Thread Starter adejones

    (@adejones)

    Have sorted it using this method:
    <li><span class="client">Client: </span> <?php echo esc_html(get_post_meta($post->ID, 'Client', true)); ?></li>

    Then mark it as resolved 😉

    Are you adding this list to your pages manually?

    Thread Starter adejones

    (@adejones)

    esmi – it is just in single.php

    So it is coded in single.php., yes? If so, can we see just that code snippet?

    Thread Starter adejones

    (@adejones)

    Yes.

    <ul class="post-meta">
    <li><span class="client">Client: </span> <?php echo esc_html(get_post_meta($post->ID, 'Client', true)); ?></li>
    <li><span class="date">Date: </span> <?php echo esc_html(get_post_meta($post->ID, 'Date', true)); ?></li>
    <li><span class="website">Website: </span> <?php echo esc_html(get_post_meta($post->ID, 'Website', true)); ?></li>
    <li><span class="services">Services Provided: </span> <?php echo esc_html(get_post_meta($post->ID, 'Services', true)); ?></li>
    </ul>

    Now using CSS I can put a background image on each class with a bit of padding so put the image next to each “value”

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Custom meta data’ is closed to new replies.