Filters for whether titles and entry headers show, and for the main loop and 404 page.
Jump to
- Titles and entry header
- Loop and 404
Titles and entry header
generate_show_title
GP Free
The generate_show_title filter allows you to choose whether to display your page titles or not.
Parameters: $value (boolean). Default: true.
add_action( 'after_setup_theme', 'tu_remove_all_titles' );
function tu_remove_all_titles() {
add_filter( 'generate_show_title', '__return_false' );
}
Guide: Content
generate_show_entry_header
GP Free
The generate_show_entry_header filter allows you remove the entire <header class="entry-header"> element.
Parameters: $value. Default: whatever the theme would otherwise decide (see the entry header markup).
add_filter( 'generate_show_entry_header', '__return_false' );
Guide: Content
generate_get_the_title_parameters
GP Free
The generate_get_the_title_parameters filter allows modify the output of post titles.
Parameters: $value. Default: the arguments GeneratePress would otherwise pass to get_the_title().
add_filter( 'generate_get_the_title_parameters', function( $params ) {
if ( ! is_singular() ) {
$params = array(
'before' => sprintf(
'<h2 class="entry-title"%2$s><a href="%1$s" rel="bookmark" target="_blank">',
esc_url( get_permalink() ),
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
),
'after' => '</a></h2>',
);
}
return $params;
} );
add_filter( 'generate_get_the_title_parameters', function( $params ) {
if ( ! is_singular() ) {
$params = array(
'before' => sprintf(
'<h3 class="entry-title"%2$s><a href="%1$s" rel="bookmark">',
esc_url( get_permalink() ),
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
),
'after' => '</a></h3>',
);
}
return $params;
} );
add_filter( 'generate_get_the_title_parameters', function( $params ) {
if ( ! is_singular() ) {
$params = array(
'before' => sprintf(
'<h2 class="entry-title"%s>',
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
),
'after' => '</h2>',
);
}
return $params;
} );
Guide: Content
Loop and 404
generate_has_default_loop
GP Free
The generate_has_default_loop filter allows you to remove the default post loop query from GeneratePress so you can hook in your own.
Parameters: $value. Default: true.
add_filter( 'generate_has_default_loop', '__return_false' );
Guide: Content
generate_404_title
GP Free
The generate_404_title filter allows you to change the default 404 title.
Parameters: $value (string). Default: Oops! That page can’t be found.
add_filter( 'generate_404_title', function( $value ) {
return $value;
} );
Guide: Content
generate_404_text
GP Free
The generate_404_text filter allows you to change the default 404 text.
Parameters: $value (string). Default: It looks like nothing was found at this location. Maybe try one of the links below or a search?.
add_filter( 'generate_404_text', function( $value ) {
return $value;
} );
Guide: Content