Archived topic
Archive Template Color of Page
3 replies · Started by Todd on January 30, 2018
Hi
My question is how to create an archive page template and have it show up properly with the correct background color. Right now when I use the code I came up with the background behind the archives is the wrong color for pages or posts and is instead the color for the site background (body when it should be content). My custom archive template page code right now is below. Thanks for any help you can provide.
<?php
/*
Template Name: Templ Archives
*/
get_header(); ?>
<div id="primary" <?php generate_content_class();?>>
<main id="main" <?php generate_main_class(); ?>>
<?php do_action('generate_before_main_content'); ?>
<?php do_action('generate_before_content'); ?>
<?php do_action( 'generate_before_entry_title' );
the_title( sprintf( '<h2 class="entry-title" itemprop="headline"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
do_action('generate_after_entry_title'); ?>
<?php do_action('generate_after_entry_header'); ?>
<h2>Monthly Archives</h2>
<ul>
<?php wp_get_archives( 'type=monthly&show_post_count=1' ); ?>
</ul>
<?php do_action('generate_after_entry_content'); ?>
<?php do_action('generate_after_content'); ?>
<?php do_action('generate_after_main_content'); ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
/**
* generate_after_primary_content_area hook.
*
* @since 2.0
*/
do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars();
get_footer();
Hi there,
After this:
<main id="main" <?php generate_main_class(); ?>>
Add this:
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_article_schema( 'CreativeWork' ); ?>>
<div class="inside-article">
Then before this:
</main><!-- #main -->
Add this:
</div><!-- .inside-article -->
</article><!-- #post-## -->
Hi,
Okay that worked. Thanks Tom for the quick solution and response.
Glad I could help! :)