Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi there

    Try placing the code in your archive.php (located in your theme’s folder)

    All the best!

    Thread Starter aynee greave

    (@ayneegreave)

    Hi Epicdevspace,
    first of all thank you!

    If I place the code INSTEAD of the existing one, when I click on a month of the archive, the whole page appear as archive – and the posts, menu etc. disappear.

    So I think it should be integrated in the existing code.
    The existing is:

    <?php
    /**
     * The template for displaying archive pages.
     *
     * Learn more: http://codex.wordpress.org/Template_Hierarchy
     *
     * @package Amadeus
     */
    
    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<main id="main" class="site-main" role="main">
    
    		<?php if ( have_posts() ) : ?>
    
    			<header class="page-header">
    				<?php
    					the_archive_title( '<h1 class="page-title">', '</h1>' );
    					the_archive_description( '<div class="taxonomy-description">', '</div>' );
    				?>
    			</header><!-- .page-header -->
    
    			<?php /* Start the Loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php
    					/* Include the Post-Format-specific template for the content.
    					 * If you want to override this in a child theme, then include a file
    					 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    					 */
    					get_template_part( 'content', get_post_format() );
    				?>
    
    			<?php endwhile; ?>
    
    			<?php the_posts_navigation(); ?>
    
    		<?php else : ?>
    
    			<?php get_template_part( 'content', 'none' ); ?>
    
    		<?php endif; ?>
    
    		</main><!-- #main -->
    	</div><!-- #primary -->
    
    <?php
    	if (!get_theme_mod('hide_sidebar_index')) {
    		get_sidebar();
    	}
    ?>
    <?php get_footer(); ?>

    do you know where should I put that code?

    Thank you very much!

    Hi there

    This is your full archives.php code

    <?php
    /**
     * The template for displaying archive pages.
     *
     * Learn more: http://codex.wordpress.org/Template_Hierarchy
     *
     * @package Amadeus
     */
    
    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<main id="main" class="site-main" role="main">
    
    <?php // Variables $month, $prevmonth, $year and $prevyear are used to section the archive display ?>
    <?php 	$month = '';
    		$prevmonth = '';
    		$year = '';
    		$prevyear = ''; ?>
    
    <?php // Cycle through all the posts to display the archive ?>
    <?php query_posts('showposts=-1'); ?>
    <?php if (have_posts()) :?>
    <header class="page-header">
    				<?php
    					the_archive_title( '<h1 class="page-title">', '</h1>' );
    					the_archive_description( '<div class="taxonomy-description">', '</div>' );
    				?>
    			</header><!-- .page-header -->
    
    <?php while (have_posts()) : the_post(); ?>
    
    	<?php // Find the month/year of the current post ?>
    	<?php $year = mysql2date('Y', $post->post_date); ?>
    	<?php $month = mysql2date('F', $post->post_date); ?>
    
    	<?php // Compare the current month with the $prevmonth ?>
    	<?php if ($month != $prevmonth) { ?>
    		<?php // If it is different, display the new month and reset $prevmonth ?>
    		<h4><?php echo $month . ' ' . $year; ?></h4>
    		<?php $prevmonth = $month; ?>
    
    	<?php // In case the previous post was a year ago in the same month ?>
    	<?php } elseif ($year != $prevyear) { ?>
    		<h4><?php echo $month . ' ' . $year; ?></h4>
    		<?php $prevmonth = $month; ?>
    		<?php $prevyear = $year; ?>
    	<?php } ?>
    
    	<?php // Display the post in this month ?>
    	<p><a href="<?php the_permalink(); ?>"><?php echo mysql2date('d.m.y', $post->post_date); ?> - <?php the_title(); ?></a></p>
    <?php endwhile;?>
    <?php else : ?>
    <?php get_template_part( 'content', 'none' ); ?>
    <?php endif; ?>
    </main><!-- #main -->
    </div><!-- #primary -->
    
    <?php
    	if (!get_theme_mod('hide_sidebar_index')) {
    		get_sidebar();
    	}
    ?>
    <?php get_footer(); ?>

    All the best!

    Thread Starter aynee greave

    (@ayneegreave)

    Hi epicdevspace,
    thank you very much!
    Ok, well I tried, as you can see when I click on it there is the menu on the left.

    One question: is it possible to have a white background, so it is possible to read?
    Or: is it possible a menu like this instead of the one in the right?

    Thank you very very much

    Hi

    You can add CSS to style this.

    All the best!

    Thread Starter aynee greave

    (@ayneegreave)

    Thank you again!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘explanation of a solved thread’ is closed to new replies.