Moving single post metas to the bottom of the post 13


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!


13 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!

Leave a Comment

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

Do you need to share some code? To display it in a nice looking syntax highlighter, wrap your code between the following tags (css code in this example) : <pre class="lang:css">YOUR CODE</pre> ( possible code language acronyms : css, php, xhtml, javascript, sql)

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="">