Last active
April 29, 2019 14:59
-
-
Save robincornett/1d89b99b4c3c0c94829e to your computer and use it in GitHub Desktop.
Modify the "no content matched your criteria" message in Genesis
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
<?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; | |
} |
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
Very helpful, thank you!