Support » Fixing WordPress » get_search_form(); is more heavier?

  • Resolved Indojepang

    (@indojepang)


    get_search_form(); is more heavier than include (TEMPLATEPATH . "/searchform.php"); ?

    Just curious.. thank u..

Viewing 10 replies - 1 through 10 (of 10 total)
  • If searchform.php exists, get_search_form() will use it; otherwise it uses its own text.

    So it’s probably better to use get_search_form() as it provides hooks that plugin authors can take advantage of.

    it’s probably better to use get_search_form() as it provides hooks that plugin authors can take advantage of.

    But which hooks, and where are they documented?

    The get_search_form filter. I don’t know where or if it’s documented, but it passes to its callbacks the default search form created in that function.

    The get_search_form filter. I don’t know where or if it’s documented, but it passes to its callbacks the default search form created in that function.

    Thanks for the reply. It turns out that it wasn’t adequately documented (at least, not IMO), so I opened a ticket about it. Until the info on that ticket’s thread makes it into the Codex, the ticket’s page is the best documentation available for get_search_form().

    Justin Tadlock

    (@greenshady)

    WordPress God

    You shouldn’t open tickets in Trac about the Codex. Trac is for reporting bugs.

    People can always discuss the documentation here and add it to the Codex.

    You shouldn’t open tickets in Trac about the Codex. Trac is for reporting bugs.

    Thanks for the info, but Trac is also for requesting enhancements, features and other things. I was requesting an enhancement to the Codex.

    It has since been made clear to me by other Trac users that this is not conventional in the wordpress.org community (you might want to check out the discussion), but I continue to take a wide view of what constitutes a “bug”: for me, anything that is an impediment to users being able to do what they want with the system is a “bug”, whether that impediment is due to a faulty line of code or a confusing paragraph of documentation that throws the user off track. Widen your scope, I’d say 🙂

    Just as a note, developers have asked that features and ideas be submitted to http://wordpress.org/extend/ideas/ rather than Trac.

    Also note the beauty of using MediaWiki for Codex means anyone can create information!

    May I asked you a question?

    How to WRAP the GET_SEARCH_FORM();
    If it is located inside a loop. Please pay attention at : get_search_form();

    The reason I ask you this question is for me to be able to STYLE the SEARCH BOX to be centered at the page.

    Please take a look the following:

    <?php else :
    if ( is_category() ) { // If this is a category archive
    printf(“<h2 class=’ccc’>Sorry, but </h2>, single_cat_title(”,false));}

    else {
    echo(“<h2 class=’center’>no post</h2>”); }
    get_search_form();

    endif;
    ?>

    Thank you

    Let me rephrase my question to be clearer:
    When a “GET_SEARCH_FORM();” tag is located inside a loop, How to WRAP the GET_SEARCH_FORM(); ?

    Please remember, my question is not: <?php get_search_form(); ?>
    BUT: get_search_form();
    Because it is inside a loop

    <?php else :
    if ( is_category() ) { // If this is a category archive
    printf(“<h2 class=’ccc’>Sorry, but </h2>, single_cat_title(”,false));}

    else {
    echo(“<h2 class=’center’>no post</h2>”); }
    get_search_form();

    endif;
    ?>

    Thank you

    <?php else :
    if ( is_category() ) { // If this is a category archive
    printf("<h2 class='ccc'>Sorry, but </h2>, single_cat_title('',false));}
    
    else {
        echo("<h2 class='center'>no post</h2>"); }
        echo('<div align="center">');
        get_search_form();
        echo('</div>');
    
    endif;
    ?>

    That should align anything in that DIV center. You can also just wrap it in a

    <div id="form"> get_search_form();</div>

    *make sure this is in your loop

    and center it with just css. That would be the way I would go.

    Also if you firebug it , the form probably as a css #id anyway so you can style it through that,that will do it sitewide, but if thats what you want then your golden

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘get_search_form(); is more heavier?’ is closed to new replies.