[Plugin: Co-Authors Plus] Sollution: replacing standard twenty-xxx entry_meta function
-
If you are using standard twenty-ten, twenty-eleven,twenty-twelve … theme, you may notice entry meta function (e.g. twentytwelve_entry_meta) which place footer to every post. This footer contains information about post author, so if you want to replace it with all co-authors, here is a sollution
1. twentytwelve_entry_meta (or twentyeleven … based on your theme) function is used in the theme with function_exist condition, so you can just copy whole twentytwelve_entry_meta function to your functions.php file
2. in this function, replace part starting with $author with this code:if(function_exists('coauthors')) { $i = new CoAuthorsIterator(); $i->iterate(); $author = ''; function author_function() { return 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() ); } do{ if (!$i->is_first()) $author .= $i->is_last() ? ' a ' : ', '; $author .= author_function (); } while($i->iterate()); } else { $author = author_function (); }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘[Plugin: Co-Authors Plus] Sollution: replacing standard twenty-xxx entry_meta function’ is closed to new replies.