Moving single post metas to the bottom of the post


This little snippet gives a simple solution to display the post metas at the bottom of a single post in the Customizr theme, (instead of right below the post title).

This code has to be pasted in the functions.php of a child theme.

 


About Nicolas

My name is Nicolas Guillaume (nikeo). I am the developer of the WordPress Customizr Theme. This website is a discussion platform, your comments are welcome!


17 thoughts on “Moving single post metas to the bottom of the post

  • Reply
    Ankur Sheel

    The above snippet wasnt working for me. More specifically, it was not removing orginal meta after the tile.
    I modified the line
    remove_action ( ‘__post_metas’ , array( TC_post_metas::$instance , ‘tc_post_metas’ ));
    to
    remove_action ( ‘__after_content_title’ , array( TC_post_metas::$instance , ‘tc_post_metas’ ));

    • Reply
      Nicolas Post author

      Hey thanks for this feedback Ankur! You are absolutely right, I just updated the snippet with the correct hook ‘__after_content_title’.
      Your contribution is much appreciated, cheers.

  • Reply
    Allison Eckel

    Hello.

    I selected the code above, copied it, and pasted it into the functions.php box in my child theme customizer. I saved it and refreshed my website, and nothing happened. The tags still appear at the top of the post, just below the title.

    Did I miss a step?
    Thank you

    • Reply
      Nicolas Post author

      Hi @Kate and @Allison, after verification I realized that there was a problem in the code.

      The hook to add the new actions has to be ‘__after_article’, instead of ‘__after_loop’.
      This is now fixed in the code snippet.

      Thanks for the feedback, this will help many people!
      Best regards and enjoy the theme.

  • Reply
    Kate Newbill

    I’m sorry to be a problem, but the new code still isn’t working … I replaced the old code, uploaded the functions.php, and the tags are still at the top under the post title.

    • Reply
      Kate Newbill

      Yes, I am 99.9% sure that I put the code in the correct place. There is a child theme for Customizr, and I placed the code in the functions.php in the child theme. I put it first at the bottom, after some other stuff that the client already had in there. When that didn’t work, I moved it to the top of the file, just after

      It doesn’t seem to make any difference no matter where in the child theme functions file I place it.

  • Reply
    Magnus

    I used this snippet and it works fine on a single post page. A related question is, how to remove or move the meta information to the bottom of the excerpt that is listed when you visit the “blog” page, i.e. the list of posts? It clutters up the page.

    Thanks for any hints.
    Best regards, Magnus

    • Reply
      MarkoH

      Hello,

      I have been looking for this also. The single post is not that much of an issue for me as there is so much stuff on single post anyhow that the meta does not affect its look that much. For excerpt it is different though when meta can suddenly take almost as much space as the text in excerpt itself. I would like to remove meta from the excerpt part if at all possible.

      • Reply
        Nicolas Post author

        Hi Marcus and Markoh,
        It’s all about setting the right condition at the beginning of the function.
        In the provided snippet, I have used the ! is_single() conditional statement.

        If you get rid of it, the metas will be moved at the bottom of the post in every WordPress context : post, page, list of posts, search results, category, tags, date archives, …

        You can target more specifically the blog page with the is_posts_page property of the global $wp_query object generated by WordPress.

        This code means : if this is NOT the blog posts page, then return nothing (break the function if you will).

        Hope this helps!

  • Reply
    Mats

    Hi

    I have two questions about the meta information:

    1. I’d like to move the metas to the bottom of the posts, both in the blog list and on the single posts.

    The single posts works fine with the code provided at the top of this page, but when I follow Nicolas instructions above, to delete
    if ( !is_single() )
    return;
    it seems like something’s missing.

    The metas shows up just above the header of the next post (in the list) instead of between the two separators at the end of the post.

    2. Is it possible to keep the publish date as it looks now and move the rest of the metas to the end of the post?

    I don’t know anything about the codes, I just copy & paste….;)

  • Reply
    Mats

    Now I’ve tried to understand what’s wrong but I don’t get it. It looks ok except for the blog list where the metas shows up below the second separator.
    When I deleted:
    //Additional action to display an hr separator between content and metas.
    //We use the priority parameter to determine the rendering order of the action
    add_action (‘__after_article’ , ‘display_hr’, 0);

    One of the separators disappeared and it looks a bit better. But it would of course great if I could be able to move the metas above the separator.
    Gaah, sorry for being such an amateur! ;)

    • Reply
      Nicolas Post author

      Hi Mats,

      You’ll want to use the collowing code to achieve what you need :

      I hope this will help :)
      Nicolas.

Leave a Comment

Your email address will not be published. Required fields are marked *

Please check the following point before adding your comment

  1. - Did you check that you have the latest version the theme installed ?
  2. - Did you read the documentation ?
  3. - If you think it could be useful, please check your system informations : Navigate to Appearance > About Customizr and go to the bottom of the page.
  4. - Did you check if your issue was already resolved ? Before posting a new topic, you'll want to make a quick research with our Google powered search tool below.

You may also use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">