CSS转换不适用于改变颜色

时间:2015-10-19 13:59:43

标签: php css wordpress

我目前正在使用PHP中的以下搜索模板在Wordpress网站上工作。

的search.php:

getopts "f:(file)(input-file)o:(output-file)" OPTX "$@"

内容的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(); ?>

这是我在样式表style_search_results.css中得到的:

<?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>

因此,当我尝试将鼠标悬停在链接上时,它不会更改文本颜色。有人知道快速修复吗?

顺便说一下,我在Google Chrome上工作。可能是一些有用的信息。

3 个答案:

答案 0 :(得分:3)

尝试

a.search-result:hover{color:#0000ff}

修改

实际问题是a标签有其他html标签 - 我们通过添加带搜索结果类的div容器来解决它

答案 1 :(得分:0)

你提供风格的方式是错误的。

请试试这个,

a.search-result:hover{color:#0000ff}

你可以看到工作DEMO HERE

答案 2 :(得分:0)

惊呆了,没有人在这里正确回答......

使用FB.login(function(response) { FB.api('/me/permissions', function(response){ console.log(response.data); }); }, {scope: 'publish_actions' });

您还可以全局分配转换以适用于所有属性,这可能不是一个糟糕的解决方案。

a.search-result { transition: all 2s ease-in-out; }我建议将a { transition: all 2s ease-in-out; }更改为2s0.3s