Skip to content

Instantly share code, notes, and snippets.

View gdeguglielmo's full-sized avatar

Giuseppina De Guglielmo gdeguglielmo

View GitHub Profile
anonymous
anonymous / WordPress - Show every result on search page
Created August 26, 2013 14:57
Display all results on search page
/* Display all results on search page */
function change_wp_search_size($query) {
if ( $query->is_search ) // Make sure it is a search page
$query->query_vars['posts_per_page'] = -1; // Change 10 to the number of posts you would like to show
return $query; // Return our modified query variables
}
add_filter('pre_get_posts', 'change_wp_search_size');
@gdeguglielmo
gdeguglielmo / remove_empty_p
Created April 24, 2014 13:05
Remove WordPress empty paragraph
function working_remove_empty_p($content) {
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
return $content;
}