Skip to content

Instantly share code, notes, and snippets.

@generatepress
Created April 23, 2015 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save generatepress/6094d2d4401fecacf143 to your computer and use it in GitHub Desktop.
Save generatepress/6094d2d4401fecacf143 to your computer and use it in GitHub Desktop.
Set the GP footer widgets with a function
add_filter('generate_footer_widgets','generate_custom_footer_widgets');
function generate_custom_footer_widgets()
{
// If we're on the posts page, set a number of footer widgets
if ( is_home() ) :
return '3'; // Show 3 footer widgets
endif;
// If we're on a category, show a different number of widgets
if ( is_category() ) :
return '5'; // Show 5 footer widgets
endif;
// For everything else, return the default
return $widgets;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment