WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. simplemoves
    Member
    Posted 1 year 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

    .cat-links,
    footer.entry-meta
    {
    display:none;
    }

    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. alchymyth
    The Sweeper & Moderator
    Posted 1 year 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
    Member
    Posted 1 year 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. alchymyth
    The Sweeper & Moderator
    Posted 1 year 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
    Member
    Posted 1 year ago #

    Both home page and single post.

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

    Thanks for your help!

  6. alchymyth
    The Sweeper & Moderator
    Posted 1 year 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:

    <?php

    (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() ) ),
    		get_the_author()
    	);
    
    		$utility_text = __( 'This entry was posted on %1$s<span class="by-author"> by %2$s</span>.', 'twentytwelve' );
    
    	printf(
    		$utility_text,
    		$date,
    		$author
    	);
    }
  7. colleengreene
    Member
    Posted 11 months ago #

    @alchymyth

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

    Thanks!

  8. alchymyth
    The Sweeper & Moderator
    Posted 11 months ago #

Topic Closed

This topic has been closed to new replies.

About this Topic