WordPress – Making Custom Fields Conditional

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

		<?php echo get_post_meta($post->ID, "thequote", true); ?>

<?php } ?>

or Making a Custom Field conditional with FRONT END EDITOR plugin enabled:

<?php if((get_post_meta($post->ID, "thequote", true))) { ?>
	<li class="plus ge1421 green last">

			<?php
			if ( function_exists( 'editable_post_meta' ) )
				editable_post_meta( get_the_ID(), 'thequote', 'rich' );
			else
				echo get_post_meta( $post->ID, 'thequote', true );
			?>

		<span id="thequote-by">
			<?php
			if ( function_exists( 'editable_post_meta' ) )
				editable_post_meta( get_the_ID(), 'thequote-by', 'rich' );
			else
				echo get_post_meta( $post->ID, 'thequote-by', true );
			?>
		</span>
	</li>
<?php } ?>

Leave a Reply