The_category循环永久链接wordpress

时间:2015-05-14 10:25:43

标签: php wordpress loops nested-loops

我目前正在开发自己的wordpress主题,到目前为止一直很好。问题是我使用永久链接和类别。该类别位于固定链接内。以下代码是我使用的(content.php):

<?php if ( has_tag ('half_half') ) : ?>
<div class="gridHalves">
    <article class="project" >
        <a class="projectLink" href="<?php the_permalink(); ?>">
            <div class="projectwrapper">
                    <div class="projectOverlayInset">
                        <div class="projectOverlay">
                            <div class="projectInfo">
                                <h4 class="categorie"><?php the_category(', '); ?></h4>
                                <h2 class="onderwerp"><?php the_title(); ?></h2>
                                <p class="writer">Written by <strong><?php the_author(); ?></strong></p>
                            </div>
                        </div>
                    </div>
                <?php if ( has_post_thumbnail() ) {
                    the_post_thumbnail();
                } ?>
            </div>
        </a>
    </article>
</div>
<?php endif; ?>

当我将the_category留在那里时,会发生以下情况: It adds the permalink after each div. Something is looping the permalink

如果我留下the_category标签,一切正常。我已经检查过w_-includes of thecategory中的函数但是找不到永久链接的任何内容。那有什么建议吗?我的循环如下:

<?php get_header(); ?>

<main id="projectengrid" class="gridmenu-closed">
    <section class="gridRightSmall">
    <?php if ( have_posts() ) : ?>  

        <?php
        // Start the loop.
        while ( have_posts() ) : the_post();

            get_template_part( 'content', get_post_format() );

        // End the loop.
        endwhile;

        // Previous/next page navigation.
        the_posts_pagination( array(
            'prev_text'          => __( 'Previous page', 'twentyfifteen' ),
            'next_text'          => __( 'Next page', 'twentyfifteen' ),
            'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
        ) );

    // If no content, include the "No posts found" template.
    else :
        get_template_part( 'content', 'none' );

    endif;
    ?>
</section> 

</main><!-- .site-main -->
<?php get_footer(); ?>

我将帖子导航留在那里,因为我想稍后使用它。

希望有人知道解决方案!好像我在那里有一些嵌套循环!

亲切的问候,

的Wouter

如果您需要任何其他信息,请告诉我们!

0 个答案:

没有答案