Delete "Posted in" line in twenty twelve home page (8 posts)

  1. simplemoves
    Posted 3 years ago #

    I am trying to delete the line "posted in (category)" on the bottom of posts on the home page in the twenty eleven theme.

    I have created a child's theme. After reading other posts in this forum, I tried inserting this code in my child's theme style.css file


    This, unfortunately, also deleted the link to reply (or comment). I want to keep that. I only want to delete the "Posted in" part.

    If it deletes the "Posted In...By...bookmark the permalink" line in each post, that's fine.

  2. Michael
    Forum Moderator
    Posted 3 years ago #

    you could re-write the function twentytwelve_entry_meta() in your child theme's functions.php and omit what you do not want.

    if you need to keep the 'posted in' for the full single posts, you might need to work with conditional statements, using is_home() http://codex.wordpress.org/Conditional_Tags

  3. simplemoves
    Posted 3 years ago #

    I guess I could, if I had any idea how to re-write a function.

    I think the code is around line 576 but I have no clue how to change it to only omit the "posted in" information.

  4. Michael
    Forum Moderator
    Posted 3 years ago #

    start by copying the full function into the functions.php of the child theme.

    do you want to remove that 'posted in' info just for the home page or also for single posts?

  5. simplemoves
    Posted 3 years ago #

    Both home page and single post.

    I assume copy the whole function.php file into child's theme?

    Thanks for your help!

  6. Michael
    Forum Moderator
    Posted 3 years ago #

    I assume copy the whole function.php file into child's theme?

    no - you do only add any new functions and copies of pluggable functions into functions.php of a child theme; http://codex.wordpress.org/Child_Themes#Using_functions.php

    so if you just created a new functions.php in your child theme, add this into the first line:


    (absolutely no other charactrers or spaces or line breaks before that)

    and possibly add this into the last line:


    inbetween, add your function; in your case a copy of the function twentytwelve_entry_meta()

    then edit it; for example leave just this:

     * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
     * This is our own twentytwelve_entry_meta() in a child theme.
     * @since Twenty Twelve 1.0
    function twentytwelve_entry_meta() {
    	$date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>',
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() )
    	$author = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
    		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    		esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ),
    		$utility_text = __( 'This entry was posted on %1$s<span class="by-author"> by %2$s</span>.', 'twentytwelve' );
  7. colleengreene
    Posted 3 years ago #


    How might I modify this with a conditional tag so that the categories meta still displays on just my single post?


  8. Michael
    Forum Moderator
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic