WordPress PHP-图像超链接


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' ).'" />';

我已尝试在a 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错误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>';