Created
April 23, 2015 06:52
-
-
Save generatepress/6094d2d4401fecacf143 to your computer and use it in GitHub Desktop.
Set the GP footer widgets with a function
This file contains 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
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