Creating search page

Hi, the search page on my site is a bit of a mess right now - What I would like is to show the post title, a feautredimage (if any) and then a short part of the post.


Hi Timothy,

Add a search.php template file in your child theme and past the code below:

 * VMS Video admin screen template.
 * @package Example

add_filter( 'the_content', 'example_view_post_content' );
 * Trim the post content.
 * @param string $content The post content.
 * @return string The post content trimmed.
function example_view_post_content( $content ) {
  return wp_trim_words( $content, 35, '...' );

// Remove unused post fragments.
beans_remove_action( 'beans_post_meta' );
beans_remove_action( 'beans_post_meta_categories' );
beans_remove_action( 'beans_post_meta_tags' );

// Load the document which is always needed at the bottom of template files.

Note that it is important to name the file search.php as it is one of the WordPress automatic template files available to overwrite the default (more info about WordPress template files here).

Happy coding,

Write a reply

Login or register to write a reply, it's free!