如何在If语句中显示引号

时间:2017-11-10 14:11:12

标签: php if-statement quotes

我在if语句中使用以下代码和联系表单的短代码,但联系表单没有显示。我认为这是因为我在错误的地方显示了引号,但我对它们应该去哪里感到有点困惑

我的代码是:

<?php 

if ($postid == "page-international.php" or $postid == "page-international-training.php" or $postid == "page-international-courses.php" or $postid == "page-international-training-course-detail.php") {
echo "<div class='get-ebook'><img class='close-ebook' src='https://www.pescado.co.uk/wp-content/themes/entyce/images/close-button-get.png' /><p class='title'><strong>Is your <br>scaffolding safe?</strong></p><span class='img'><img src='http://dev14.entycestudio.co.uk/wp-content/themes/custom/images/get-ebook.png' />

</span><?php echo do_shortcode('[contact-form-7 id='6664' title='ebook']' ); ?>

</div>";

} else {
echo "";
}

?>

如果有人可以提供帮助,或指出我正确的方向,我们将不胜感激: - )

由于

1 个答案:

答案 0 :(得分:1)

您的问题可能是您在echo "";尝试将do_shortcode从那里删除的事实。像这样

  echo "<div class='get-ebook'><img class='close-ebook' 
  src='https://www.pescado.co.uk/wp-content/themes/entyce/images/close-
  button-get.png' /><p class='title'><strong>Is your <br>scaffolding
  safe?</strong></p><span class='img'><img 
  src='http://dev14.entycestudio.co.uk/wp-content/themes/custom
  /images/get-ebook.png' />

  </span>";echo do_shortcode('[contact-form-7 id="6664" title="ebook"]' ); 

  echo "</div>";

  } else {
  echo "";
    }