I’m currently developing my own wordpress theme and so far so good. The problem is I’m using a permalink and a category. The category is inside the permalink. The following code is what I’m using (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 following is happening when I leave the_category in there:
If i leave the_category tag out everything is working fine. I’ve already checked the function in wp-includes of the_category but couldn’t find anything about the permalink. So any suggestions? My loop is the following:
<?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(); ?>
I left the post navigation in there because I want to use it later on.
Hope someone knows the solution to this! Seems like I’m having some nested loops in there!
Kind regards,
Wouter
If you need any additional info please let me know!