WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display one custom field value alongside a second, where the first one is key (2 posts)

  1. SchuminWeb
    Member
    Posted 9 months ago #

    I need to display the data from two separate custom fields next to each other, where, if one of the fields has data, both fields display.

    What I want to do is say "Season 3, episode 13" (and similar) and if the season part is empty, display nothing, but if the episode part is blank, display "Season 3" only.

    I'm doing this right now:

    <?php
    			$var = get_post_meta($post->ID, 'infobox_episode_season', true);
    			if ($var == '')
    			{
    			echo "";
    			} else {
    			echo "<br />Season " . $var . "";
    			} ?><?php
    			$var = get_post_meta($post->ID, 'infobox_episode_number', true);
    			if ($var == '')
    			{
    			echo "";
    			} else {
    			echo ", episode " . $var . "";
    			} ?>

    Is there a way to put it in one big, coherent PHP command?

  2. SchuminWeb
    Member
    Posted 9 months ago #

    Never mind - this is minor, and my current solution works well enough. Have another issue that is more pressing that I still need to figure out how best to describe.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.