Results 1 to 4 of 4

Thread: If else PHP coding

  1. #1
    Thread Starter
    patrickcrielaard's Avatar
    Join Date
    Apr 2013
    Location
    Netherlands
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts

    If else PHP coding

    Hello,

    I am terrible in coding so hopefully someone could help me out here:

    I am trying to create a if elso echo

    From:
    PHP Code:
    <?php echo get_post_meta $post->ID'cp_city'true ); ?>
    to the situation that if there is data in cp_city available it show the data. When there is no data available in cp_city it says: no data available.

    I tried an old code:
    PHP Code:
    <?php
                         
    if ( get_post_meta [$post->ID'cp_city']->data ) {
                                   echo 
    get_post_meta $post->ID'cp_city'];->data;
                                                }
                         else {
                                      echo 
    "no data available";
                }
                             
    ?>
    But this code aint working unfortunatly.
    Any suggestions on changing the code?

    Best,
    Patrick

  2. #2
    ridabenharrou's Avatar
    Join Date
    Jun 2011
    Location
    Morocco
    Posts
    169
    Thanks
    2
    Thanked 45 Times in 32 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. The Following User Says Thank You to ridabenharrou For This Useful Post:

    patrickcrielaard (May 7th, 2013)

  4. #3
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    arthemes.org - AppThemes plugins, tutorials, modifications and services

  5. The Following User Says Thank You to dikiyforester For This Useful Post:

    patrickcrielaard (May 7th, 2013)

  6. #4
    Thread Starter
    patrickcrielaard's Avatar
    Join Date
    Apr 2013
    Location
    Netherlands
    Posts
    18
    Thanks
    4
    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. Dimitris Css coding in cp3.2 - Should this be like this?
    By bleem in forum Report ClassiPress Bugs
    Replies: 3
    Last Post: December 12th, 2012, 01:04 PM
  2. Dimitris Css coding in cp3.2 - Should this be like this?
    By bleem in forum ClassiPress General Discussion
    Replies: 3
    Last Post: December 12th, 2012, 01:04 PM
  3. Need some coding help, please.
    By dmyers in forum ClassiPress General Discussion
    Replies: 3
    Last Post: October 17th, 2010, 02:31 AM
  4. CAn anyone help with PHP coding?
    By dollarpermile.com in forum ClassiPress General Discussion
    Replies: 1
    Last Post: June 14th, 2010, 06:50 PM