Blog posts repeating in content.php
-
Hi there,
I am trying to create my main blog page to have my blog posts on the left side and come code on the right.
However, my template is repeating lots of code, for example my breadcrumbs and also the sidebar from each actual listing page.
This is what my content.php file looks like:
<article id="post-<?php the_ID(); ?>"><?php get_template_part( 'inc/thumbnail' ); the_title( '<h2 class="post-title"><a href="' . esc_url( get_permalink() ) . '">', '</a></h2>' ); get_template_part( 'inc/post-meta' ); if ( is_category() || is_archive() || is_search() ) { the_excerpt(); } else { the_content(''); } ?> <a href="<?php echo esc_url( get_permalink() ); ?>" class="btn btn-primary read-more-btn"><?php _e('Read more', 'jobseek'); ?></a> </article> <-- ORIGNAL CODE FROM CONTENT.PHP --> <!-- MY CUSTOM CODE BELOW --> <section id="content"> <div class="container"> <!-- BREADCRUMNB --> <div class="container breadcrumbs"> <?php echo do_shortcode( '[yoast-breadcrumb]'); ?> </div> <!-- end BREADCRUMBS --> <div class="container"> <div class="row flex-column-reverse flex-lg-row"> <div class="col-lg-8 col-md-12 page-content blog"> CONTENT POST HERE </div> <div class="col-lg-4 col-md-12"> BAR AT SIDE </div> </div> </div> </div> </section>
and this is what my actual posts (content-single.php) looks like:
<section id="content"> <div class="container"> <!-- BREADCRUMNB --> <div class="container breadcrumbs"> <?php echo do_shortcode( '[yoast-breadcrumb]'); ?> </div> <!-- end BREADCRUMBS --> <div class="container"> <div class="row flex-column-reverse flex-lg-row"> <div class="col-lg-8 col-md-12 page-content blog"> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php the_title( '<h2 class="post-title">', '</h2>' ); get_template_part( 'inc/post-meta' ); the_content();?> </article> <?php if ( function_exists( 'sharing_display' ) ) { ?> <div class="share"> <?php sharing_display( '', true ); ?> </div><?php } if ( get_the_author_meta( 'description' ) ) : get_template_part( 'author-bio' ); if( has_tag() ) { the_tags( '<ul class="tags"><li>', '</li><li>', '</li></ul>' ); } endif; if ( get_post_type() == 'post' ) { ?> <?php echo do_shortcode("[adsense_text_links]");?> <ul class="paging"> <li class="prev"><?php previous_post_link( '%link', __('<i class="fas fa-chevron-left"></i> Previous', 'jobseek') ); ?></li> <li class="next"><?php next_post_link( '%link', __('Next <i class="fas fa-chevron-right"></i>', 'jobseek') ); ?></li> </ul><?php } if ( is_single() && ( get_post_type() == 'post' ) ) { comments_template(); } ?> </div> <div class="col-lg-4 col-md-12"> <?php include("wp-content/themes/jobseek-child/inc/blog-related.php"); ?> <?php echo do_shortcode("[adsense_text_links]");?> </div> </div> </div> </div> </section>
Can anyone see what I have wrong?
I’m guessing I must have a loop somewhere?
Thank you.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Blog posts repeating in content.php’ is closed to new replies.