Created a very simple plugin to display a custom search form. No errors, but not performing search. I may be over my head and leaving out one or many requirements.

My plugin code:

 * Begin Shortcode.
function divilicious_micro_search($atts, $content = null) {
   extract(shortcode_atts(array('color' => 'teal'), $atts));

   return '<div id="dlms">
            <form role="search" method="get" action="' . home_url( '/' ) . '"  class="dlms">
              <input type="search" class="dlms-search-input" placeholder="'.esc_attr__('Search...','dlms').'" value="'.get_search_query().'" name="s" title="Search for:" >
              <button style="background:'.$color.'" type="submit">
                <span class="fontawesome-search"></span>

add_shortcode('dl-micro-search', 'divilicious_micro_search');

Am I missing something that will give me a fighting chance or shall I give up?

  • Highlight your code in editor and then click the {} sign above the editor. Or simply indent each line with 4 spaces. This will all display your code in a code block Oct 26 '15 at 14:26
  • Works for me. Please try to describe your problem in more detail.
    – s_ha_dum
    Oct 26 '15 at 14:29
  • Here is my test page. Click the orange icon to open, enter your search term and see what happens (or not). divilicious.com/a-micro-search-plugin-shortcode-test-page Oct 26 '15 at 14:35

You aren't executing the shortcode. The raw text is simply being echoed to the page. I don't know why, but I assume you've just written something like [ dl-micro-search color="hex or named color" ] into the source when you should have echo do_shortcode('[ dl-micro-search color="hex or named color" ]'); instead.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.