简体   繁体   English

使PHP按钮可点击

[英]Making a PHP Button Clickable

Firstly, thanks so much for your help. 首先,非常感谢您的帮助。

I am creating a Wordpress site for a client which you can see here: http://christchurchhelicopters.co.nz/new 我正在为一个客户创建一个Wordpress网站,您可以在这里看到: http : //christchurchhelicopters.co.nz/new

Essentially, for user experience, we want to make each of the tours clickable (as in the image as well). 从本质上讲,为了获得用户体验,我们希望使每个游览都可点击(也如图所示)。 This is because at the moment, all that's clickable is the title, which isn't obvious. 这是因为此刻,可单击的只是标题,这并不明显。

I found the code where it's all stored, but can't work out a way to put the link to the tour URL into the href tags. 我找到了全部存储在其中的代码,但是无法找到一种将游览URL的链接放入href标记的方法。

Code: 码:

<?php
/**
* @package  WordPress
* @subpackage   Travel Time
* @version      1.0.0
* 
* Posts Slider Standard Tour Format Template
* Created by CMSMasters
* 
*/


$cmsmasters_metadata = explode(',', $cmsmasters_project_metadata);

$title = (in_array('title', $cmsmasters_metadata)) ? true : false;
$excerpt = (in_array('excerpt', $cmsmasters_metadata) && travel_time_project_check_exc_cont()) ? true : false;
$categories = (get_the_terms(get_the_ID(), 'pj-categs') && (in_array('categories', $cmsmasters_metadata))) ? true : false;
$comments = (comments_open() && (in_array('comments', $cmsmasters_metadata))) ? true : false;
$likes = (in_array('likes', $cmsmasters_metadata)) ? true : false;
$icon = in_array('icon', $cmsmasters_metadata) ? true : false;
$duration = in_array('duration', $cmsmasters_metadata) ? true : false;
$participants = in_array('participants', $cmsmasters_metadata) ? true : false;
$price = in_array('price', $cmsmasters_metadata) ? true : false;
$rating = in_array('rating', $cmsmasters_metadata) ? true : false;


$cmsmasters_project_icon = get_post_meta(get_the_ID(), 'cmsmasters_project_icon', true);
$cmsmasters_project_duration = get_post_meta(get_the_ID(), 'cmsmasters_project_duration', true);
$cmsmasters_project_participants = get_post_meta(get_the_ID(), 'cmsmasters_project_participants', true);
$cmsmasters_project_price = get_post_meta(get_the_ID(), 'cmsmasters_project_price', true);


$cmsmasters_project_link_url = get_post_meta(get_the_ID(), 'cmsmasters_project_link_url', true);

$cmsmasters_project_link_redirect = get_post_meta(get_the_ID(), 'cmsmasters_project_link_redirect', true);


?>

<!--_________________________ Start Standard Tour _________________________ -->

<article id="post-<?php the_ID(); ?>" <?php post_class('cmsmasters_slider_project'); ?>>
<div class="cmsmasters_slider_project_outer">
<div class="project_outer_image_wrap">

<?php 
if ($icon || $price || $categories || $title || $likes || $comments) {
echo '<div class="project_outer_image_wrap_meta entry-meta">';

$icon ? travel_time_project_icon($cmsmasters_project_icon) : '';

$price ? travel_time_project_price($cmsmasters_project_price, 'page') : '';

if ($categories || $title || $likes || $comments) {

echo '<div class="project_outer_image_wrap_meta_bottom entry-meta">';

$categories ?  travel_time_get_slider_post_category(get_the_ID(), 'pj-categs', 'project') : '';

$title ? travel_time_slider_post_heading(get_the_ID(), 'project', 'h2', $cmsmasters_project_link_redirect, $cmsmasters_project_link_url) : '';

$comments ? travel_time_get_slider_post_comments('project') : '';   

$likes ? travel_time_slider_post_like('project') : '';

echo '</div>';

}

echo '</div>';
}

travel_time_thumb_rollover(get_the_ID(), 'cmsmasters-tour-thumb', false, true, false, false, false, false, false, false, true, $cmsmasters_project_link_redirect, $cmsmasters_project_link_url);

echo '</div>';

if ($excerpt || $duration || $participants || $rating ) {
echo '<div class="project_inner">';

$excerpt ? travel_time_slider_post_exc_cont('project') : '';

echo '<footer class="cmsmasters_project_footer entry-meta">';

$duration ? travel_time_project_duration($cmsmasters_project_duration, 'page') : '';

$participants ? travel_time_project_participants($cmsmasters_project_participants, 'page') : '';

if (CMSMASTERS_SIMPLE_RATING && $rating ) {
travel_time_simple_rating(get_the_ID(), 'page');
}

echo '</footer>';


echo '</div>';
}

?>
</div>
</article>
<!--_________________________ Finish Standard Tour _________________________ -->

I'm reading from mobile, so hope I'm not missing something on the code above, but seems that the function travel_time_thumb_rollover is responsible of printing the link. 我正在从移动设备上阅读内容,因此希望我不会在上面的代码中缺少任何内容,但是似乎函数travel_time_thumb_rollover负责打印链接。 Try looking for it with a recursive full text search in your project folder. 尝试使用递归全文搜索在项目文件夹中查找它。 Basically you should unwrap the <a> around the title to put it around the whole thumbnail. 基本上,您应该将<a>展开以将其放在整个缩略图中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM