Created
July 22, 2015 13:05
-
-
Save gicolek/f82e6fb5d2313c0cef8d to your computer and use it in GitHub Desktop.
ACF Recent Posts Widget before hook
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
<?php | |
remove_filter( 'acp_rwp_before', array( 'ACF_Helper', 'af_bf_content_filter' ) ); | |
add_filter( 'acp_rwp_before', 'wp_doin_before_custom_text', 999, 3 ); | |
/** | |
* @hook acp_rwp_before | |
*/ | |
function wp_doin_before_custom_text($before, $instance, $id) { | |
// note that to make usage of all function arguments | |
// you will need to provide the hook with priority and extra params argument | |
// say we want to append custom author info to the widget with author CSS class | |
// after each post before content | |
if ( $instance['css'] === 'author' ) { | |
$before .= '<h3>Posted by: ' . get_the_author() . '</h3><hr />'; | |
} | |
return $before; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment