0

Hi I'm writing a plugin to include custom search results. I'm not really allowed to edit any theme pages, but the search results page in twentyfourteen's search.php seem hardcoded to me:

        <header class="page-header">
            <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfourteen' ), get_search_query() ); ?></h1>
            <?php if (function_exists("getGlossarySearchResults")) { echo getGlossarySearchResults(); }  ?>
        </header><!-- .page-header -->

I have to display the results before the normal search results. So is there any way modify the results output header from code?

| improve this question | | | | |
  • 1
    Why don't you just create a child theme and then do your changes in there – Pieter Goosen Apr 25 '14 at 11:00
1

No but I suggest you create a child theme, this will give you full control over the site without affecting the original theme... in there you can create a functions.php page and customize the search from there.

you can search for a child theme plugin that can create it for you, and some of them include editors...

| improve this answer | | | | |
  • I suggested the same in comments already. To make your answer useful, please add some links that support your suggestions, preferably something from the codex. As it currently stands, your answer should actually be a comment – Pieter Goosen Apr 25 '14 at 11:09
  • Sorry noob to this... can i promote the plugins that I use? – Nemothefish Apr 25 '14 at 11:15
  • You cannot promote, bu you can suggest. You can change "you can search for a child theme plugin that can create it for you" to "I use some plugin to create my child themes for me" – Pieter Goosen Apr 25 '14 at 11:22
1

Under the assumption that you just need your custom search results to show up on the search results page, you'll want write the function that will insert your customized results after an if is_search() statement like so:

if (is_search()){
    //code that retrieves or displays your custom search results
    }

The code that will retrieve or display the custom search results will vary depending on what these custom results are.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.