Created
June 3, 2015 16:38
-
-
Save mintplugins/aeac07660a5d0ab5117e to your computer and use it in GitHub Desktop.
MP Stacks + DownloadGrid: How to add the Author to the Title for Grid Items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_downloadgrid_add_author_to_title( $post_title, $post_id ){ | |
//Get the author of the post in question | |
$post_object = get_post( $post_id ); | |
$author_id = $post_object->post_author; | |
$author_nicename = get_the_author_meta( 'user_nicename', $author_id ); | |
return $post_title . ' | ' . $author_nicename; | |
} | |
add_filter( 'mp_stacks_downloadgrid_item_title', 'my_downloadgrid_add_author_to_title', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment