WordPress.org

Ready to get started?Download WordPress

Forums

Leaf
Move article footer meta to header (5 posts)

  1. iambob
    Member
    Posted 1 year ago #

    Hi,

    Not a coder, but sometimes I can manage to figure out what I'm thinking of trying ... not this time! Would like to achieve two changes:

    1. Move the meta line (author, permalink, date, categories) that appears underneath the full article page to instead appear under the article title header.

    2. Also have the same meta info/line appear on the site homepage, likewise underneath the article title/above the body content.

    Appreciate any hints & ideas!
    Bob

  2. tizz
    Member
    Posted 1 year ago #

    I'm not a coder too, but I can give some inputs, not a complete solution.
    First, you have to install Leaf child theme
    Then, you had to know that the interested function is
    <?php leaf_entry_meta(); ?>
    For HP, there's no problem. You have to copy home.php in child theme and then in that copy add <?php leaf_entry_meta(); ?> where you want to display it, between title and summary:

    <h2 class="entry-title">
    <a href="<?php the_permalink(); ?> etc.
    
    <?php leaf_entry_meta(); ?>
    
    <div class="entry-summary">

    If you want a space, add < br / >.
    The HP is divided into sections, so you'll do the same thing for each section.

    For the single post, this is more difficult, and I can't tell you at the moment how to do. The difficulty lies in the fact that the title and content are called together in a template with

    <?php get_template_part( 'content', 'single' ); ?>

    so if you call entry_meta before that, these will end up before the title.
    The solution, I think, is to write a function or a plugin that can render entry_meta after title and before single content. That's the part where I can't help you.
    After that, to remove entry_meta from footer, you'll need just a simple .entry-meta {display:none;} in custom CSS.

  3. iambob
    Member
    Posted 1 year ago #

    Thanks Tizz! The inserted line for the homepage placement works nice and simple, so my brain appreciates that tip.

    The follow on parts for single post changes is still a bit above my capacity even more than your own, but thanks for the additional good clues ... given time I might figure it out! (I like to avoid plugins whenever possible, as so many have so much overhead cf. what a simple line or two of code can achieve).

    Appreciate helping me move forward another inch!
    Bob

  4. tizz
    Member
    Posted 1 year ago #

    Ops, checking what I wrote in the very last part, I realize that if you hide entry_meta with CSS in that way, it will also remove the other entries, so you'll have to do it via template.

    Edit: with "plugin" I was referring to a specific little script, not an external one, and I agree with you in this matter.

  5. tizz
    Member
    Posted 1 year ago #

    Solved, even for the single article page, and it's very simple. I realized now that there's a content-single.php file.
    Copy it into your child theme via FTP, then cut the part

    <footer class="entry-meta">
    <?php leaf_entry_meta(); ?>
    </footer><!-- .entry-meta -->

    and paste it a few lines up between

    <header class="entry-header">
    <h1 class="entry-title"><?php the_title(); ?></h1>

    and

    </header><!-- .entry-header -->

    So you'll have

    <header class="entry-header">
    	<h1 class="entry-title"><?php the_title(); ?></h1>
    <footer class="entry-meta">
    <?php leaf_entry_meta(); ?>
    </footer><!-- .entry-meta -->
    		</header><!-- .entry-header -->

    That's all.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic