GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   Code Help (https://gfy.com/showthread.php?t=1060780)

dgraves 03-12-2012 12:46 AM

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>

rweb 03-12-2012 02:38 AM

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
}
?>


dgraves 03-12-2012 12:39 PM

awesome, thanks for your help. i'll give this a try.


All times are GMT -7. The time now is 01:30 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123