.footer-widgets .footer-widget-1 {
flex-basis: 40%;
}
.footer-widgets .footer-widget-2 {
flex-basis: 20%;
}
.footer-widgets .footer-widget-3 {
flex-basis:30%;
}
.footer-widgets .footer-widget-4 {
flex-basis: 10%;
}
generatepress
// GeneratePress Search Box Clear
add_filter( 'generate_navigation_search_output', 'tu_remove_search_query' );
function tu_remove_search_query() {
printf( // WPCS: XSS ok, sanitization ok.
'<form method="get" class="search-form navigation-search" action="%1$s">
<input type="search" class="search-field" value="" name="s" title="%2$s" />
</form>',
esc_url( home_url( '/' ) ),
esc_attr_x( 'Search', 'label', 'generatepress' )
);
}
generate press exclude categories from posts page
add_filter('pre_get_posts', 'excludeCat');
function excludeCat($query) {
if ( $query->is_home ) {
$query->set('cat', '-3,-5,-23');
}
return $query;
}
To hide Uncategorized posts use -1
disable block editor in widgets
// disable block editor */
add_filter( 'use_widgets_block_editor', '__return_false' );
gp hide featured image
/* generatepress hide featured image on all PAGES */
.single .page-header-image-single, .page-header-image, .page-header-image-single {
display: none;
}
/* show featured image on all POSTS */
article.category-music-leaders div.page-header-image-single {display: inherit;}
change generatepress color palette
previous solution
// change gp color palette
add_filter( 'generate_default_color_palettes', 'tu_custom_color_palettes' );
function tu_custom_color_palettes( $palettes ) {
$palettes = array(
'#351C4D', /* brand */
'#FEBF7B', /* accent */
'#FF7E5F', /* action */
'#765285', /* hover */
'#C1c1c1', /* light */
'#fe7b84', /* midtone */
'#000000', /* black */
'#FFFFFF', /* white */
);
return $palettes;
}
gp featured post excerpt length
// gp blog - featured post excerpt length
add_filter( 'excerpt_length', function( $length ) {
global $wp_query;
if ( 0 === $wp_query->current_post && !wp_is_mobile() ) {
// Set Length of first post on desktop
$length = 50;
} else {
// Set Length of other posts and all posts on mobile
$length = 20;
}
return $length;
}, 200);
empty cart in nav redirect to shop
// woo gp - navigation - empty cart redirect to shop
add_action( 'template_redirect', 'empty_cart_redirect' );
function empty_cart_redirect(){
if( is_cart() && WC()->cart->is_empty() ) {
wp_safe_redirect( get_permalink( wc_get_page_id( 'shop' ) ) );
exit();
}
}
enqueue font awesome
/**
* Enqueue Font Awesome.
*/
add_action( 'wp_enqueue_scripts', 'tu_load_font_awesome' );
function tu_load_font_awesome() {
wp_enqueue_style( 'font-awesome', '//use.fontawesome.com/releases/v5.5.0/css/all.css', array(), '5.5.0' );
}
enqueue google fonts
/**
* Add Google Fonts to Generate Press
*/
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
$fonts[ 'Livvic' ] = array(
'name' => 'Livvic',
'variants' => array( '100', '100i', '200', '200i','300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ),
'category' => 'sans-serif'
);
$fonts[ 'Barlow Condensed' ] = array(
'name' => 'Barlow Condensed',
'variants' => array( '100', '100i', '200', '200i','300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ),
'category' => 'sans-serif'
);
$fonts[ 'Barlow Semi Condensed' ] = array(
'name' => 'Barlow Semi Condensed',
'variants' => array( '100', '100i', '200', '200i','300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ),
'category' => 'sans-serif'
);
return $fonts;
}