Add custom to top of post in functions.php?
-
I have been able to define a custom field (url_crosslink) for each post, which is a reference URL; I edited single.php and now is shows up at the top of individual posts – perfect! (see, for example, https://blogs.esa.int/atv/2011/01/06/super-cool-video-atv-in-two-minutes/).
here’s my code: <?php echo c2c_get_custom(‘url_crosslink’, ‘| Cette mise à jour en fran?ais ‘); ?>
BUT: I would like this same custom field to also appear at the top of each post when it’s displayed in home, so I think I have to edit the theme’s functions.php file (am using twentyten) here:
* Prints HTML with meta information for the current post—date/time and author. * * @since Twenty Ten 1.0 */ function twentyten_posted_on() { printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ), 'meta-prep meta-prep-author', sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>', get_permalink(), esc_attr( get_the_time() ), get_the_date() ), sprintf( '<span class="author vcard"><a href="%1$s" title="%2$s">%3$s</a></span>', get_author_posts_url( get_the_author_meta( 'ID' )), sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ), get_the_author() ) ); } endif;
I would be grateful if anyone had any suggestions!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add custom to top of post in functions.php?’ is closed to new replies.