How To Create Dynamically Search Categories and Child Categories Only Form

  • 1 comments
  • 1 Comment
    Posted 14 Dec 2010 in WordPress Tricks

    Using WordPress there are unlimited abilites, all you can do on WordPress. Today WordPress Tutorial is How To Create Dynamically Search Categories and Child Categories Only Form.

    There are some problem or litle bit hack to create custom WordPress, example we want to create search form only on spesify categories. Using This code below you can do it easely.

    To Use this code is simple, just write down this code whatever you want put this form and done.

    <form method=”get” id=”searchform” action=”<?php bloginfo(‘home’); ?>/”>
    <div id=”search”>
    <input type=”text” value=”Search… ” onclick=”this.value=”;” name=”s” id=”s” />
    <?php $categories = get_categories(‘child_of=1′);
    $catlist = ”;
    foreach ($categories as $cat) {
    $catlist.= $cat->cat_ID.’,';
    }
    $catlist.’5′;
    ?>
    <input type=”hidden” name=”cat” value=”<?php echo “$catlist”?>” />
    <input name=”" type=”image” src=”<?php bloginfo(‘stylesheet_directory’); ?>/styles/<?php echo “$style_path”; ?>/search.gif” value=”Go” class=”btn” />
    </div><!–/search –>
    </form>

    You can tweak this code, example you need to search on category 3, Edit on child_of parameter above.
    Thanks for WP Garage to create tutorial How To Create Dynamically Search Categories and Child Categories Only Form



    1 Comments

    1. ayu'

      setelah dicopypastekan
      webnya gk jalan

      blank putih

      Reply


    Add Your Comment

    Enter your comment*:

    * Required fields