search.php in child theme

  • Mariana
    Mariana
    Newbie 14 points
    April 11, 2015 at 3:05 pm

    So this cameup in my last topic, the search.php in the DT folder cannot be overwitten by a search.php in the child theme. If I create a search.php file in my child theme it overwrites the search results page instead. Can anyone please help me with this?

    thanks in advance

  • Mark
    Mark
    Titan 733 points
    April 11, 2015 at 8:19 pm

    Can you explain what you mean? The search.php is the source for the search results page, so if you change it in your child theme, it should affect it. That is the idea. Not sure what you are trying to do.

    Mark

  • Mariana
    Mariana
    Newbie 14 points
    April 21, 2015 at 3:32 pm

    Well there are 2 ways to see posts
    1> is by clicking a category on the homepage which wil bring you to that category and show you the posts that belong to that category and 2> is by using search to fiend stuff which wil bring you to a search results page.

    The search.php in the DT folder is the source for the first one but if I put a search.php in my child theme it changes the second one (search results)

    this confuses me how do I overwite the first one?

  • Mark
    Mark
    Titan 733 points
    April 21, 2015 at 8:26 pm

    What exactly are you trying to do?

    search.php is used for both, the difference is in the query that is being executed (it also calls some other templates depending on what is being requested like content-listing.php or content-listing-diectory.php)

    The easiest way to make modifications to your search/category pages design/layout is via admin > Theme Options > Page Setup > Search Result Layout (and select ‘Use Custom Layout’).

    Mark

  • Mariana
    Mariana
    Newbie 14 points
    April 21, 2015 at 8:52 pm

    I whant to add an extra sort option and a filter so that my users can filter the posts on a custom atribute I added. The atribute I added allows me to see what package was used to create the post (paied or free) and I whant my users to only show paied ones or only show free ones.

    I hope I explained that right its kind of hard to explain but thank you for your replies.

  • Mark
    Mark
    Titan 733 points
    April 22, 2015 at 1:12 am

    Why don’t you use the advanced search for ‘filtering’ and the custom ‘order by’ functionalities? (you can find it under admin > Theme Options > General Setup > Advanced Search – there you can setup both, ‘Advanced Search Fields’ and ‘Custom Orderby Options’

  • Mark Fail
    Mark Fail
    Super Guru 13,013 points
    April 22, 2015 at 3:59 am

    It maybe better to create your own template page and use this for your custom search, if you customize the core theme search options you’ll need to edit core files which will be lost with updates.

  • Mariana
    Mariana
    Newbie 14 points
    April 22, 2015 at 11:55 am

    Mark: thats not possible because I modded the template in my child theme, what I whant is not in the basic functionalities.

    Mark Fail: what do you mean? I already have a child theme can’t I do that in there?

Viewing 8 posts - 1 through 8 (of 8 total)

New Business Themes for WordPress 2020

Start your new website today!

View Business Themes