Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Date and Byline under title

By: a guest on Jan 21st, 2013  |  syntax: None  |  size: 1.72 KB  |  views: 1,023  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. In your child function.php file:
  2.  
  3. function abyline_posted_on() {
  4.         $link= esc_url( get_permalink() );
  5.         $title= esc_attr( get_the_title() );
  6.         $time= esc_attr( get_the_time() );
  7.         $dateGMT= esc_attr( get_the_date( 'c' ) );
  8.         $date= esc_html( get_the_date() );
  9.         $authorURL= esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );
  10.         $author= esc_html( get_the_author() );
  11.         echo ('<span class="sep">Posted on</span> <a href="'.$link.'" title="'.$title.'" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>'.$date.'</time></a> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="'.$authorURL.'" title="'.$author.'" rel="author">'.$author.'</a></span>');
  12.     }
  13.    
  14. *You can name the function anything you want as long it matches the call in the content.php file. I call my function 'abyline_posted_on'  
  15.    
  16. -----------------------
  17. In your child content.php
  18.  
  19. Look for this section:
  20.  
  21. <header class="entry-header">
  22.                         <?php the_post_thumbnail(); ?>
  23.                         <?php if ( is_single() ) : ?>
  24.                         <h1 class="entry-title"><?php the_title(); ?></h1>
  25.                 ******* <?php abyline_posted_on(); ?><!-- this is the first call to the byline function for single posts -->
  26.  
  27.                         <?php else : ?>
  28.                         <h1 class="entry-title">
  29.                                 <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
  30.                         </h1>
  31.  
  32.                 ******        <?php abyline_posted_on(); ?><!-- this is the 2nd call to the byline function -->
  33.  
  34.                         <?php endif; // is_single() ?>
  35.                        
  36.                        
  37. *Note* I wrap my byline calls in a DIV to style the text but that is up to you