Displaying a different field if "default" one is empty
-
Hello everyone,
I am currently working on the website for my company and while I’ve managed to get everything up and running, there are some customizations I need to implement.
I currently run WordPress 3.5.1 with a Premium template called WP Automotive Pro.
I want to be able to have 2 different titling options. On the home page I have some “Featured Listings”. Since the title is displayed in small boxes, I need to limit its length.
However, on my full listing page, I’d like to be able to display a longer title.
See homepage here: https://royalauto.byethost33.com
For example, if you click on the Alfa-Romeo, it works properly, because both fields have content. But on any other page, the extended title doesn’t display since it is left empty.
I’d like to display the regular title for the listings where the extended title field is empty.
So far, this is the code.
<h3 class="address marB0"><?php echo get_post_meta($post->ID, "_ct_exttitle", true); ?></h3>
I’m sure I need to add some if and else parameter in this, but I am not well-versed with pure coding.
Thank you in advance.
Best regards,
Yann[bump moderated]
- The topic ‘Displaying a different field if "default" one is empty’ is closed to new replies.