我目前正在使用以下搜索模板在PHP中使用Wordpress網站。CSS轉換不能用於更改顏色
的search.php:
<?php
/**
* The template for displaying search results pages.
*
* @package WordPress
* @subpackage Twenty_Fifteen
* @since Twenty Fifteen 1.0
*/
get_header(); ?>
<link rel="stylesheet" href="wp-content/themes/twente.com/style_search_results.css" />
<div class="global-wrap " role="alien-grid" data-grid-cols="4">
<div class="column full">
<div class="item maincontent">
<article class="search-results">
<?php if (have_posts()) : ?>
<h1> <?php
$mySearch =& new WP_Query("s=$s & showposts=-1");
$num = $mySearch->post_count; ?>
Er zijn <?php echo $num; ?> berichten gevonden.
<?php //printf(__('Search Results for: %s', 'twentyfifteen'), get_search_query()); ?>
</h1>
<?php
// Start the loop.
while (have_posts()) : the_post(); ?>
<?php
/*
* Run the loop for the search to output the results.
* If you want to overload this in a child theme then include a file
* called content-search.php and that will be used instead.
*/
get_template_part('content', 'search');
// End the loop.
endwhile;
// Previous/next page navigation.
the_posts_pagination(array(
'mid_size' => 2,
'prev_text' => __('Vorige pagina', 'twentyfifteen'),
'next_text' => __('Volgende pagina', 'twentyfifteen'),
));
// If no content, include the "No posts found" template.
else :
get_template_part('content', 'none');
endif;
?>
</article>
</div>
</div>
</div>
<?php get_footer(); ?>
內容的search.php:
<?php
/**
* The template part for displaying results in search pages
*
* Learn more: {@link https://codex.wordpress.org/Template_Hierarchy}
*
* @package WordPress
* @subpackage Twenty_Fifteen
* @since Twenty Fifteen 1.0
*/
?>
<a href="<?php the_permalink(); ?>" class="search-result">
<article>
<h2><?php the_title(); ?></h2>
<?php the_excerpt($more); ?>
</article><!-- #post-## -->
</a>
這是我在樣式表style_search_results.css了:
a.search-result {
display: block;
text-decoration: none;
color: black;
border-bottom: 1px solid #ccc;
border-bottom-left-radius: 29px;
margin: 0 0 0 -25px;
transition: color 2s;
}
a:hover.search-result {
color: #0000ff;
}
所以,當我嘗試將鼠標懸停在鏈接上,它不會更改文本顏色。有人知道一個快速解決?
順便說一下,我在Google Chrome中工作。可能是一些有用的信息。
a.search-result:hover {color:#0000ff;} – InbetweenWeekends