• Currently on blog posts, the default display for dates is the top left hand corner above the blog post title. Is there a way to move the date to show under the blog post title instead? Thank you in advance!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Mimi,

    Good question! The most reliable way to do this is through a child theme…then you can just swap the order around in the template file, without having to worry about losing your changes in an update. If you set up a child theme and need help making the swap in the code, let us know.

    In theory, you could also do this in a slightly hacky way with some javascript, but that isn’t really ideal. ??

    Thread Starter Mimi

    (@feedmi)

    Hi Steven,

    Thanks for your response! I was able to set up a child theme. Could you give me a little more guidance on how to swap the code? Sorry, I am a WordPress newbie.

    Nice work!

    Now if you copy single.php from the “kale” folder into your child theme folder, you can edit the new copy.

    Around lines 36-43, you should see this code:

                <div class="entry-header">
    				<?php if($kale_posts_meta_show == 1 && $kale_posts_date_show == 1) { ?>
                    <div class="entry-meta">
                        <div class="entry-date date updated"><?php the_date(); ?></div>
                    </div>
    				<?php } ?>
    				<div class="clearfix"></div>
                </div>

    Select that block of code and move it to under the following code, which was around lines 45-50:

                <?php $title = get_the_title(); ?>
                <?php if($title == '') { ?>
                <h1 class="entry-title"><?php esc_html_e('Post ID: ', 'kale'); the_ID(); ?></h1>
                <?php } else { ?>
                <h1 class="entry-title"><?php the_title(); ?></h1>
                <?php } ?>

    So your final code should look like this:

                <?php $title = get_the_title(); ?>
                <?php if($title == '') { ?>
                <h1 class="entry-title"><?php esc_html_e('Post ID: ', 'kale'); the_ID(); ?></h1>
                <?php } else { ?>
                <h1 class="entry-title"><?php the_title(); ?></h1>
                <?php } ?>
    
                <div class="entry-header">
    				<?php if($kale_posts_meta_show == 1 && $kale_posts_date_show == 1) { ?>
                    <div class="entry-meta">
                        <div class="entry-date date updated"><?php the_date(); ?></div>
                    </div>
    				<?php } ?>
    				<div class="clearfix"></div>
                </div>

    That should do the trick…let us know if you run into any issues!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change location of date on blog posts’ is closed to new replies.