Results 1 to 2 of 2

Thread: Update ad title - php code syntax?

  1. #1
    Thread Starter
    Expired Customer p90x8's Avatar
    Join Date
    Jan 2016
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  2. #2
    Thread Starter
    Expired Customer p90x8's Avatar
    Join Date
    Jan 2016
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Need to list business name as title on top of QR code
    By anuraagv in forum QR Codes Widget
    Replies: 2
    Last Post: May 22nd, 2014, 08:00 AM
  2. Add Adsense code below Blog Entry Title
    By kenmasterpty in forum Vantage General Discussion (Legacy)
    Replies: 0
    Last Post: May 17th, 2014, 03:18 PM
  3. Dimitris Title not inputted - whats wrong with this code?
    By ranstey2208 in forum Help Using Vantage (Legacy)
    Replies: 2
    Last Post: February 18th, 2014, 09:15 AM
  4. How can i move the coupon box (i.e. Code: [Coupon Code]) below the title
    By geronimo in forum Clipper General Discussion
    Replies: 2
    Last Post: November 24th, 2012, 08:43 AM
  5. Do Permalinks Auto Update When Ad Title Is Changed?
    By valance in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: March 3rd, 2011, 05:12 PM