Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将div组链接到选定的永久链接?_Php_Html_Wordpress_Permalinks - Fatal编程技术网

Php 将div组链接到选定的永久链接?

Php 将div组链接到选定的永久链接?,php,html,wordpress,permalinks,Php,Html,Wordpress,Permalinks,我正在创建一个新闻中心,其中包含指定类别的最新wordpress帖子。它包括帖子图片和标题。div组有一个悬停动画,我希望该类在单击时链接到文章,并从中提取标题和图像 目前它只链接,如果你点击标题本身,我想能够点击整个块,它链接到文章。有什么想法吗?这是目前的代码 <?php query_posts('cat=1 &posts_per_page=1'); ?> <?php if ( have_posts() ) : while ( have_posts() ) : t

我正在创建一个新闻中心,其中包含指定类别的最新wordpress帖子。它包括帖子图片和标题。div组有一个悬停动画,我希望该类在单击时链接到文章,并从中提取标题和图像

目前它只链接,如果你点击标题本身,我想能够点击整个块,它链接到文章。有什么想法吗?这是目前的代码

 <?php query_posts('cat=1 &posts_per_page=1'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="block-1">
        <div class="news-center-overlay transition">
        <p>VIEW FULL STORY</p>
            <div id="news-line-box">
            <div id="part-1"></div><div id="part-2"><img src="<?php echo get_stylesheet_directory_uri()?>/img/star.png"/> </div><div id="part-3"></div>
            </div>
            <h4>COMETS BASKETBALL</h4>
        </div>

        <a href="<?php the_permalink() ?>"><?php echo get_the_post_thumbnail( $post_id, $size, $attr ); ?></a>

        <p class="news-center-title animation"><a href="<?php the_permalink() ?>"><?php echo get_the_title( $ID ); ?></a></p>
    </div>
<?php endwhile; endif; ?>

据我所知,您希望单击一个块,其中包含指向该块下的帖子的链接

如果是这种情况,可以将块包装在href链接中,或者将href链接包装到新闻中心覆盖类中

    <?php query_posts('cat=1 &posts_per_page=1'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
     <a href="<?php the_permalink(); ?>">
        <div class="block-1">
            <div class="news-center-overlay transition">
            <p>VIEW FULL STORY</p>
                <div id="news-line-box">
                <div id="part-1"></div><div id="part-2"><img src="<?php echo get_stylesheet_directory_uri()?>/img/star.png"/> </div><div id="part-3"></div>
                </div>
                <h4>COMETS BASKETBALL</h4>
            </div>

            <?php echo get_the_post_thumbnail( $post_id, $size, $attr ); ?>

            <p class="news-center-title animation"><a href="<?php the_permalink() ?>"><?php echo get_the_title( $ID ); ?></a></p>
        </div>
     </a>
    <?php endwhile; endif; ?>