• I have a Bible that i am able to search using a search php file. When this result returns the results, it does not look like my site theme. How would i include the theme layout into a search php file? I have tried adding the get_header and get_sidebar function to the php file and get this error when using the search:
    Fatal error: Call to undefined function: get_header() in /srv/www/htdocs/wp-includes/search.php on line 9
    The search in question is https://www.mytimewithgod.net/126 type in a word/phrase and you will see the result page does not look like the site. Did i explain this right. Anyway, any help is appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • I got an error when searching, so didn’t see a result.

    If the bible search is outside the WP directory, then you’ll need to add this code to the header of the files that you want to use WP template tags with

    <?php
    require('./path-to-your-blog/wp-blog-header.php');
    ?>

    Thread Starter carnold

    (@carnold)

    Thanks miklb! The Bible search is not outside of the WP directory. The search is in wwwroot/wp-includes/search.php. My install of WP is in the wwwroot. I added this, <?php require(‘./wp-blog-header.php’);?>, line between <header></header> of the search.php file. Get this error:
    Warning: main(./wp-blog-header.php): failed to open stream: No such file or directory in /srv/www/htdocs/wp-includes/search.php on line 7

    Fatal error: main(): Failed opening required ‘./wp-blog-header.php’ (include_path=’.:’) in /srv/www/htdocs/wp-includes/search.php on line 7

    Ah. You want to use the search file within your theme perhaps. I’m not well versed in coding searches within WP, so I can’t be of much help there.
    How are you getting WP to search files that are not in the database? Or did you create Pages for all of the content, and have that within the database?

    Thread Starter carnold

    (@carnold)

    This Bible is outside of WP. It is in its own folder (wwwroot/kjvdict/all files here (no folders)). I made a page for the Bible and made a search to search that Bible and display the results. The results are what i am wanting to be “themed”. Try again, goto https://www.mytimewithgod.net/126 and in the search type “romans” and click search (you should get results). You will see the results page is not with my “theme”.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Include theme’ is closed to new replies.