[英]WordPress PHP - Hyperlink on image
首先對不起,如果這是一個簡單的問題,這是我第一次使用html / word press,這只是一個學習練習
基本上我已經在word-press上下載了lawyeria lite主題,並且在這個主題中他們在主頁上有三個圖標,文本在它們下面,我想要做的就是讓用戶可以點擊圖像並被帶到另一個頁面,但在主題的自定義選項中這是不可能的。
我想我已經找到了與此相關的PHP,下面,我的問題是我如何修改這個以實現我的目標?
<?php
if ( get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_icon',get_template_directory_uri().'/images/features-box-icon-one.png' ) ) {
echo '<div class="features-box-icon">';
echo '<img src="'.get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_icon', get_template_directory_uri().'/images/features-box-icon-one.png' ).'" alt="'.get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_title' ).'" title="'.get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_title' ).'" ;/>';
echo '</div>';
}
if ( get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_title','Lorem' ) ) {
echo '<h4>';
echo get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_title','Lorem' );
echo '</h4>';
}
if ( get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_content','Go to Appearance - Customize, to add content.' ) ) {
echo '<p>';
echo get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_content','Go to Appearance - Customize, to add content.' );
echo '</p>';
}
?>
</div><!--/div .features-box-->
我已經縮小到這行代碼:
echo '<img src="'.get_theme_mod( 'lawyeria_lite_frontpage_secondlybox_icon',get_template_directory_uri().'/images/features-box-icon-two.png' ).'" alt="'.get_theme_mod( 'lawyeria_lite_frontpage_secondlybox_title','Ipsum' ).'" title="'.get_theme_mod( 'lawyeria_lite_frontpage_secondlybox_title','Ipsum' ).'" />';
我試過添加一個href
echo '< href="page.php" 'img src="'.get_theme_mod( 'lawyeria_lite_frontpage_secondlybox_icon',get_template_directory_uri().'/images/features-box-icon-two.png' ).'" alt="'.get_theme_mod( 'lawyeria_lite_frontpage_secondlybox_title','Ipsum' ).'" title="'.get_theme_mod( 'lawyeria_lite_frontpage_secondlybox_title','Ipsum' ).'" />';
但這會產生HTTP ERROR 500
非常感謝
好吧,看起來我是在正確的軌道,但錯誤的格式,這就是我如何實現我想要的
echo '<a href="pageone.php"><img src="'.get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_icon', get_template_directory_uri().'/images/features-box-icon-one.png' ).'" alt="'.get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_title' ).'" title="'.get_theme_mod( 'lawyeria_lite_frontpage_firstlybox_title' ).'" ;/></a>';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.