Skip to content

Instantly share code, notes, and snippets.

@generatepress
generatepress / gist:bb195b0ecd8f833f9845
Last active February 15, 2024 18:10
Initiate mobile menu at a smaller width than 768px. Replace the 600px with whatever you like.
@media (max-width: 769px) {
.menu-toggle,
.main-navigation.toggled .main-nav > ul {
display: none;
}
.main-navigation ul li.sfHover > ul {
display: block;
}
@generatepress
generatepress / gist:67fb28af5c8be3103290
Last active August 2, 2023 19:32
Remove the link to the author page
add_filter( 'generate_post_author_output','tu_no_author_link' );
function tu_no_author_link() {
printf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <span class="fn n author-name" itemprop="name">%4$s</span></span>',
__( 'by','generatepress'),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() )
)
);
@generatepress
generatepress / gist:282078076cd8631c17717d5b8640c043
Last active May 15, 2023 22:00
Initiate the mobile header at your desired width. Change 768px to whatever you like.
@media( max-width: 768px ) {
.site-header,
#site-navigation,
#sticky-navigation {
display: none !important;
opacity: 0;
}
#mobile-header {
display: block !important;
@generatepress
generatepress / gist:d58dd082dbd741943aee
Last active February 27, 2023 15:18
Overwrite our GP header so you can change the order of elements. Note: This will only work in GeneratePress 1.2.9.7 and beyond.
if ( ! function_exists( 'generate_header_items' ) ) :
/**
* Build the header
*
* Wrapping this into a function allows us to customize the order in a child theme
*
* @since 1.2.9.7
*/
function generate_header_items()
{
@generatepress
generatepress / remove-customize-sections
Last active October 6, 2022 03:09
Remove sections from GeneratePress Customize area
add_action( 'customize_register', function( $wp_customize ) {
// Remove default sections
$wp_customize->remove_section('generate_colors_section');
$wp_customize->remove_section('generate_typography_section');
$wp_customize->remove_panel('generate_layout_panel');
// Remove Menu Plus section.
$wp_customize->remove_panel('generate_menu_plus');
// Remove Generate Backgrounds section
@generatepress
generatepress / functions.php
Created April 16, 2018 16:49
Set archives to full width if using Elementor Themer.
add_action( 'wp', function() {
add_filter( 'body_class', function( $classes ) {
if ( function_exists( 'elementor_location_exits' ) && elementor_location_exits( 'archive', true ) ) {
$classes[] = 'full-width-content';
}
return $classes;
} );
} );
@generatepress
generatepress / gist:2d037a5a7341ffc67c6af1a056b54e34
Created June 7, 2018 15:51
Remove Google Fonts from the Customizer
add_action( 'admin_init', 'tu_remove_google_fonts' );
function tu_remove_google_fonts() {
add_filter( 'generate_google_fonts_array', '__return_false' );
}
#bbpress-forums,
div.bbp-breadcrumb,
div.bbp-topic-tags,
#bbpress-forums ul.bbp-lead-topic,
#bbpress-forums ul.bbp-topics,
#bbpress-forums ul.bbp-forums,
#bbpress-forums ul.bbp-replies,
#bbpress-forums ul.bbp-search-results,
#bbpress-forums li.bbp-body ul.forum,
#bbpress-forums li.bbp-body ul.topic {
@generatepress
generatepress / gist:18e41e03783b5c7e86402d429e64efc0
Created September 23, 2016 16:06
Remove commas from in between tags and categories
if ( ! function_exists( 'generate_entry_meta' ) ) :
/**
* Prints HTML with meta information for the categories, tags.
*
* @since 1.2.5
*/
function generate_entry_meta()
{
$categories = apply_filters( 'generate_show_categories', true );
$tags = apply_filters( 'generate_show_tags', true );
/* MENU ITEMS */
.main-navigation {
background-color: #222222;
}
.main-navigation .navigation-search input[type="search"],
.main-navigation .navigation-search input[type="search"]:active {
color: #FFFFFF;
background-color: #1e72bd;
}