Support » Fixing WordPress » Search field also in non-sidebar template

  • Resolved aclassifier

    (@aclassifier)


    I use the Twenty Twelve theme. When I use a template without the sidebar, the search field is not there. I guess it’s because it’s considered that there is no space for it. I would still like to have it there, like at the top or bottom of the page. I use pages only, no posts (except the top post). Is there a way to solve this?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    You can do it with a shortcode

    https://www.wpbeginner.com/wp-tutorials/how-to-add-search-form-in-your-post-with-a-wordpress-search-shortcode/

    or automate the process by using a filter on the_content to put the function that gets a search form above or below your content.

    Thanks!

    So if I don’t want to edit in the twentytwelve\ file, can I make a twentytwelve-child\functions.php and add

    add_shortcode('wpbsearch', 'get_search_form');

    there instead?

    And usage is with

    [wpbsearch]

    somewhere in my blog page?

    Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    Yes and yes.

    My twentytwelve-child/functions.php now contains
    <?php add_shortcode('wpbsearch', 'get_search_form'); ?>
    and it works! Thanks a lot!

    Are there any other relevant questions I should have asked?

    By the way, I did not respond on @sterndata alternative scheme

    or automate the process by using a filter on the_content to put the function that gets a search form above or below your content.

    because the first I could attack better. But if that would mean that I did not have to insert anything in my blog note, it would have been interesting. Still I mark this as resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.