Skip to content

Instantly share code, notes, and snippets.

@samikeijonen
Last active August 25, 2016 18:18
Show Gist options
  • Select an option

  • Save samikeijonen/e71b69e6f57c2ce07dd242145de953b3 to your computer and use it in GitHub Desktop.

Select an option

Save samikeijonen/e71b69e6f57c2ce07dd242145de953b3 to your computer and use it in GitHub Desktop.
Add content to recent post widget. In this case just before after_widget parameter.
<?php
/**
* Add content to Recent Posts Widget.
*
* @since 1.0.0
*
* @param array $params Array of widget arguments.
* @return array Modified 'after_widget' argument.
*/
function prefix_add_content_to_recent_post_widget( $params ) {
if( ! is_admin() && false !== strpos( $params[0]['widget_id'], 'recent-posts' ) ) {
$params[0]['after_widget'] = 'Add you content' . $params[0]['after_widget'];
}
return $params;
}
add_filter( 'dynamic_sidebar_params', 'prefix_add_content_to_recent_post_widget' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment