Skip to content

Instantly share code, notes, and snippets.

@robincornett

robincornett/functions.php

Last active Apr 29, 2019
Embed
What would you like to do?
Modify the "no content matched your criteria" message in Genesis
<?php
// do not include the opening tag
add_filter( 'genesis_noposts_text', 'leaven_change_search_text_one', 10, 2 );
function leaven_change_search_text_one( $text ) {
$text .= __( ' Would you like to try again?', 'leaven' );
$text .= get_search_form( false );
return $text;
}
add_filter( 'genesis_noposts_text', 'leaven_change_search_text_two', 10, 2 );
function leaven_change_search_text_two( $text ) {
$text = __( 'This is completely embarrassing. I have no posts to show you. Care to search again?', 'leaven' );
$text .= get_search_form( false );
return $text;
}
add_filter( 'genesis_noposts_text', 'leaven_change_search_text_three', 10, 2 );
function leaven_change_search_text_three( $text ) {
if ( is_search() ) {
$text = __( 'This is completely embarrassing. I have no posts to show you. Care to search again?', 'leaven' );
} elseif ( is_archive() ) {
$text = __( 'Evidently I don\'t have much to say on this topic. Maybe you\'d like to search for something else.', 'leaven' );
}
$text .= get_search_form( false );
return $text;
}
@sitealacarte

This comment has been minimized.

Copy link

@sitealacarte sitealacarte commented Feb 2, 2017

Very helpful, thank you!

@alexgarciab

This comment has been minimized.

Copy link

@alexgarciab alexgarciab commented Mar 11, 2019

Is there a way to insert a heading on the page, apart from the modified text?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.