I want to show text or file with if else statement. If text is input in box it will show the input text otherwise it will show input your text from admin panel. the code may be like this,

 <?php if(!empty('projects')) { ?>

          <?php echo get_post_meta(get_the_ID(), 'projects', true);   ?>

            <?php }

 else  echo __("<h2> input your text from admin panel </h2>", "casanova")  ?>

though this is not working, but how can i do that? thanks for help.


this will be like this

<?php  $project_counter = get_post_meta(get_the_ID(), 'projects', true);  ?>
            <?php  if(!empty($project_counter)) {?>
             <?php echo $project_counter;   ?>
                                <?php }
  else  {echo __("<h2> Input value from theme option panel </h2>", "casanova"); }  ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.