Code Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dgraves
    Confirmed User
    • Nov 2005
    • 2283

    #1

    Code Help

    hey guys, i need some help with some code. what code would i use if i only wanted to show "Cumshots" when there is a value entered? i tired:

    <?php if((get_post_meta($post->ID, "shots", true)) ) { ?>

    but it didn't work.

    <td><span>Name:</span> <? echo $name ?></td>
    <td><span>Video:</span> <? echo $video ?></td>
    <td><span>Pictures:</span> <? echo $pics ?></td>
    <td><span>Cumshots:</span> <? echo $shots ?></td>
    Gloryhole Swallow | Cumpsters | Spy Tug | Cum Clinic | Chica's Place
  • rweb
    Registered User
    • Feb 2012
    • 24

    #2
    I assume you're talking about WordPress.

    I don't know what are the $name, $video and $pics variables in your code, but if you have a custom field named 'shots' and you want to display it's value if it exists, then this works:
    PHP Code:
    <?php
    $shots = get_post_meta($post->ID, "shots", true);
    if($shots) {
    ?>
      <td><span>Cumshots:</span> <? echo $shots ?></td>
    <?php
    }
    ?>
    Chaturbate plugin for WordPress | Simple tube plugin for WordPress

    Comment

    • dgraves
      Confirmed User
      • Nov 2005
      • 2283

      #3
      awesome, thanks for your help. i'll give this a try.
      Gloryhole Swallow | Cumpsters | Spy Tug | Cum Clinic | Chica's Place

      Comment

      Working...