Forums

custom field value inside it's own tag (3 posts)

  1. furiber
    Member
    Posted 4 months ago #

    hello, im new to custom fields, so i was wondering, is it posible to get the value (since it's only the key that does it) of a custom field inside a particular tag?

    let me show you what i want:
    the output im getting is


    <ul class="post-meta">

  2. <span class="post-meta-key">Dolar:</span>
    2214
  3. is there a way to get it this way:


    <ul class="post-meta">

  4. <span class="post-meta-key">Dolar:</span>
    <span class="value">2214<span>
  5. thank you in advance.

  • esmi
    Member
    Posted 4 months ago #

    How about:

    <?php
    if(get_post_meta($post->ID, 'key_name')):?>
    <span class="post-meta-key">Dolar:</span>
    <span class="value"><?php echo get_post_meta($post->ID, 'key_name',true);?><span>
    <?php endif;?>
  • furiber
    Member
    Posted 4 months ago #

    i'm kinda lost here, i don't know what exact change should i do so i can get it out thath way.

    i think i have to replace some ID ro something but not really sure. help once again. LOL

    thanks, you very much for your help.

  • Reply

    You must log in to post.

    About this Topic

    Tags