- This topic has 3 replies, 2 voices, and was last updated 8 years, 2 months ago by
Tom.
Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
January 30, 2018 at 8:54 am #483701
Todd
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();January 30, 2018 at 3:13 pm #483966Tom
Lead DeveloperLead DeveloperHi 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-## -->January 30, 2018 at 4:59 pm #484043Todd
Hi,
Okay that worked. Thanks Tom for the quick solution and response.
January 30, 2018 at 9:47 pm #484145Tom
Lead DeveloperLead DeveloperGlad I could help! 🙂
-
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.