我正在創建一個wordpress網站。 我的客戶要求我在整個php中進行編碼。 但有時,某處無法使用php。 我結合PHP爲HTML如何在HTML網站中將HTML調用到PHP中?
如:
<a class="single_post_title" href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<h1 class="single_post_heading heading_blog"><?php the_title(); ?></h1>
</a>
如果我使用
<?php
echo '<a class="single_post_title" href="'.the_permalink().'" title="'.the_title().'">
<h1 class="single_post_heading heading_blog">'.the_title().'</h1>
</a>';
?>
那麼這個詞按網站顯示<a class="single_post_title" href="" title="">
而我用火的錯誤檢驗。 href和title屬性是空的。 可能是該功能the_permalink()
內建的wordpress的原因,已經迴應鏈接。所以當我使用href="'.the_permalink().'"
時,鏈接會在href屬性中重複兩次。
我該如何使用PHP將這些HTML代碼調用到PHP中?
問題更多的細節編輯......可你們經歷好嗎? –