Community Forums › Forums › Archived Forums › General Discussion › How do I create a custom Search Results Page
Tagged: custom search template
- This topic has 4 replies, 2 voices, and was last updated 10 years, 10 months ago by Jen Baumann.
-
AuthorPosts
-
December 13, 2012 at 3:07 pm #5039kategorgeousMember
Hi,
I have been asked to post this question on the forum. I want the results of my "Search" to be formatted differently and I'm not sure how to do this.
The way I want it is to give a small list of links (like the search results page on this forum) and not include the date/time/posting details.
I have managed to remove the date/time and posting details by asking the stylesheet to not display them but I still have the issue where the results give too much information and I only want a few lines of each.
How do I format my search results page so that it looks more like the search results page like this forum?
Thanks
Kate
http://www.underbrella.co.uk
Learn from yesterday, live for today, hope for tomorrowDecember 13, 2012 at 3:15 pm #5042Jen BaumannParticipantSo you want just the title and the excerpt? We need more info as to how your site is setup (theme options for blog), including your url.
December 13, 2012 at 3:52 pm #5052kategorgeousMemberThanks for the quick response. At the moment (using the Platinum theme) on my website http://www.cathywilcoxtraining.com/ when I do a search then the results page comes up with all the information from the relevant pages (ie the entire page of data) rather than a snippet of information and a "more" link or something.
Also, if there are no results it says "Sorry, no posts matched your criteria" but I would prefer not to have the word posts there at all.
Which settings did you mean?
Thanks
Kate
http://www.underbrella.co.uk
Learn from yesterday, live for today, hope for tomorrowDecember 13, 2012 at 4:42 pm #5070Jen BaumannParticipantThat gives me enough info. To filter the No Posts Text:
add_filter('genesis_noposts_text','custom_noposts_text'); function custom_noposts_text() { $custom_text = "Drat. I really should write about that, shouldn't I? Try another search."; return $custom_text; }
Create a search.php file and put it in your child theme folder with this content:
<?php /** Remove the post info function */ remove_action( 'genesis_before_post_content', 'genesis_post_info' ); /** Remove the post meta function */ remove_action( 'genesis_after_post_content', 'genesis_post_meta' ); /** Removes everything form post content **/ remove_all_actions( 'genesis_post_content' ); /** Add your custom content **/ add_action( 'genesis_post_content', 'custom_post_content' ); function custom_post_content() { the_content_limit( '800', __( 'Read More »', 'child_textdomain' ) ); } genesis();
You can change the 800 to whatever length you want. Note that if you have filtered the Read More in functions.php, the functions.php version will rule unless you also remove the filter here in this file.
February 11, 2014 at 7:16 am #89785Jen BaumannParticipantFor HTML5 themes, the search.php would contain the following to show only post titles:
<?php /** Remove the post info function */ remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); /** Remove the post meta function */ remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); /** Removes everything form post content **/ remove_all_actions( 'genesis_entry_content' ); genesis();
-
AuthorPosts
- The topic ‘How do I create a custom Search Results Page’ is closed to new replies.