Useful tweaks to your twenty twelve wordpress theme

Before you make any tweaks to your twenty twelve theme, you need to create a child theme. I have talked about how to create a child theme for your twenty twelve from your modified theme. That post didn’t talk about functions.php at all. This post looks into the functions.php and how to do some tweaks on the child theme.

First off,  you don’t need to copy functions.php as is to your child theme folder. As that has a function to declare the setup of the theme, and adding it again will re-declare it. This will throw up an error. So create a blank functions.php and add the required functions there.

How to remove the permalink linked on the time stamp.

You don’t need a permalink as your title is already linking to the full post. You can remove it if you don’t want to link it twice.

You can use the function below to remove the permalink. It’s on the line 13 on the code below,

You can as well as remove the date altogether, to do that on the line 8, modify the code to,

You are passing an empty string to the $date variable and commenting out the 2 date functions.

How to modify or remove “This entry was posted in”

You can as well as change the “This entry was posted in” or remove it, look from line 20 on the code above.

As well as you can choose if you want the tags and categories to appear or not. It’s unclear how to de-link those, but I guess its not something worth caring about.

On the line 20, you have 3 conditions, if the post has tags, then categories then if nothing is present. You can change these if you don’t want them appearing after each post. %1$s denotes categories, %2$s for tags and %3$s for author name.

How to display posts meta data on the top

It’s by default displayed after the content. From the content.php, look for footer tag and copy all inside the tag and place it after the title. Or you can just copy the twentytwelve_entry_meta(); and the edit like I did in the code below. So the header code will look like,

You can then remove the footer tag altogether.

2 comments

  • knolpadblog

    You got to enclose it in a function

    function twentytwelve_entry_meta() { }

  • Frank Kjell

    Hey man, this did not work, made an empty functions.php and just copied the code for “this story was posted…” All i got was an error text on top of the site

    ( $tag_list ) {

    $utility_text = __( ‘This story was posted in %1$s and tagged %2$s on %3$s by %4$s.’, ‘twentytwelve’ );

    } elseif ( $categories_list ) {

    $utility_text = __( ‘This story was posted in %1$s on %3$s by %4$s.’, ‘twentytwelve’ );

    } else {

    $utility_text = __( ‘This story was posted on %3$s by %4$s.’, ‘twentytwelve’ );

    }

Leave a Reply

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