Update ad title - php code syntax?
Hi,
I have 2 text fields. cp_game_type, and cp_ad_type.
User will input one or the other, depending on what form they use.
Depending on which is chosen, I want it to display in front of the title correctly.
So my logic is, if cp_game_type chosen, output to title; else, output cp_ad_type.
Need some help with php syntax.
From content-ad_listing.php,
<div class="<?php cp_display_style( array( 'ad_images', 'ad_class' ) ); ?>">
<?php appthemes_before_post_title(); ?>
<!-- Changes made -->
<h3><a href="<?php the_permalink(); ?>">
<!-- Conditions -->
<?php if (get_post_meta($post->ID,'cp_game_type',true) = true) ?>
{
<?php echo get_post_meta($post->ID,'cp_game_type',true); ?>
} else {
<?php echo get_post_meta($post->ID,'cp_ad_type',true); ?> }
<!-- Displayed behind ad type-->
<?php _e( ' - ', APP_TD ); ?>
<?php if ( mb_strlen( get_the_title() ) >= 75 ) echo mb_substr( get_the_title(), 0, 75 ) . '...'; else the_title(); ?></a></h3>
<div class="clr"></div>
I can't get the if-else condition to work.
It should return something like this, if cp_ad_type is used:
(cp_ad_type)" - "(Title)
WTS - Test ad 123
WTS is short for want to sell, one of my ad types.
Any ideas?