Making titles clickable

时间:2015-12-04 作者:Dennis

http://thewowstudio.com/quad/

我希望我的标题可以单击

谁能帮我弄清楚我该怎么做?我已经试了一个小时了,但没有任何帮助。

谢谢

<?php
/**
 * The default template for displaying content
 *
 * Used for both single and index/archive/search.
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */
?>

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
        <div class="featured-post">
            <?php _e( \'Featured post\', \'twentytwelve\' ); ?>
        </div>
        <?php endif; ?>
        <header class="entry-header">
            <?php if ( ! post_password_required() && ! is_attachment() ) :
                the_post_thumbnail(array(400,200));
            endif; ?>

            <?php if ( is_single() ) : ?>
            <h3 class="entry-title"><?php the_title(); ?></h3>
            <?php else : ?>
            <h4 class="entry-title">
                <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
            </h4>
            <?php endif; // is_single() ?>
            <?php if ( comments_open() ) : ?>
                <div class="comments-link">
                    <?php comments_popup_link( \'<span class="leave-reply">\' . __( \'Leave a reply\', \'twentytwelve\' ) . \'</span>\', __( \'1 Reply\', \'twentytwelve\' ), __( \'% Replies\', \'twentytwelve\' ) ); ?>
                </div><!-- .comments-link -->
            <?php endif; // comments_open() ?>
        </header><!-- .entry-header -->

        <?php if ( is_search() ) : // Only display Excerpts for Search ?>
        <div class="entry-summary">
            <?php the_excerpt(); ?>
        </div><!-- .entry-summary -->
        <?php else : ?>
        <div class="entry-content">
            <?php the_content( __( \'Continue reading <span class="meta-nav">&rarr;</span>\', \'twentytwelve\' ) ); ?>
            <?php wp_link_pages( array( \'before\' => \'<div class="page-links">\' . __( \'Pages:\', \'twentytwelve\' ), \'after\' => \'</div>\' ) ); ?>
        </div><!-- .entry-content -->
        <?php endif; ?>

        <footer class="entry-meta">
            <?php twentytwelve_entry_meta(); ?>
            <?php edit_post_link( __( \'Edit\', \'twentytwelve\' ), \'<span class="edit-link">\', \'</span>\' ); ?>
            <?php if ( is_singular() && get_the_author_meta( \'description\' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>
                <div class="author-info">
                    <div class="author-avatar">
                        <?php
                        /** This filter is documented in author.php */
                        $author_bio_avatar_size = apply_filters( \'twentytwelve_author_bio_avatar_size\', 68 );
                        echo get_avatar( get_the_author_meta( \'user_email\' ), $author_bio_avatar_size );
                        ?>
                    </div><!-- .author-avatar -->
                    <div class="author-description">
                        <h2><?php printf( __( \'About %s\', \'twentytwelve\' ), get_the_author() ); ?></h2>
                        <p><?php the_author_meta( \'description\' ); ?></p>
                        <div class="author-link">
                            <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( \'ID\' ) ) ); ?>" rel="author">
                                <?php printf( __( \'View all posts by %s <span class="meta-nav">&rarr;</span>\', \'twentytwelve\' ), get_the_author() ); ?>
                            </a>
                        </div><!-- .author-link -->
                    </div><!-- .author-description -->
                </div><!-- .author-info -->
            <?php endif; ?>
        </footer><!-- .entry-meta -->
    </article><!-- #post -->
内容。php

2 个回复
最合适的回答,由SO网友:Rishabh 整理而成

然而,你的问题的答案已经给出了,但在你的网站上,我看到了另一个bug。在站点的右侧栏中,您已经显示了产品列表,但产品的标题没有显示鼠标悬停时的单击符号样的产品图像。若你们也想解决这个问题,那个么下面的代码就会显示出这个问题。

<div class="rightinerh1">
<a target="_blank" href="http://rads.stackoverflow.com/amzn/click/B014HAGXGI"quadcoptersco-20"%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB014HAGXGI">
<label>JJRC H8D FPV Headless Mode 6-Axis 2.4Ghz Gyro RTF RC Quadcopter Helicopter Drone with 5.8G 2MP HD Camera Red EU Plug with US Adapter</label>
</a>
<label class="sidebarnewstime">$117.00</label>
<br>
</div>
正如您所知,上述代码包含标题的所有格式。

Why is title is not showing click symbol?
因为在上面的代码中title text 包含在中<label> 标签你需要删除它<label> 标记,以便<a> 标签可以完全执行其功能。找出<div class="rightinerh1"> 并移除这些标签。如果您正在使用插件,请在插件文件夹中查找此div,否则请在主题中查找此div。如果是插件,在开始搜索该div之前,您可以尝试第一个插件的管理部分(在仪表板中),并搜索所有可能解决问题的可用设置。

SO网友:IXN

实际上,您需要的是在标题中添加相应文章的链接。

问题不在你的index.php 但在你的滑块上。查找。包含以下内容的php文件div :

<div class="amazingslider-title-1"> your title here </div>
并将以下代码用于div

<div class="amazingslider-title-1">     
<?php the_title( sprintf( \'<h2 class="entry-title"><a href="%s" rel="bookmark">\', esc_url( get_permalink() ) ), \'</a></h2>\' ); ?>
    </div>

相关推荐