Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author joe_bopper

    (@joe_bopper)

    Hi Sam,

    Thanks for the kind words.

    I hadn’t made this into a widget as, given that WordPress comes with a search widget, I didn’t see much call for it.

    On the other hand, I went and made it anyway. Add the code found in this link, Widget Extension, to a file in your plugins folder and add the header

    /*
    Plugin Name: My Search Widget Plugin
    */

    to that (you may name the file whateveryoulike.php).

    Enabling this plugin should give you what you’re after.

    Cheers,
    Joe

    P.S. References:

    These should give you an idea of how I went about making it and they should be good reference for debugging if you have any issues.

    Thread Starter S R

    (@the-goshorn-9)

    Thanks, I’ll try it and report back to you!

    Oh, where exactly do I add the header?

    Thread Starter S R

    (@the-goshorn-9)

    Hi Joe,

    I made the php file and uploaded it into my plugins folder.
    It showed up in the Plugins:
    https://prntscr.com/9w59o0

    However, I try to activate it and it gives me this error code:

    Parse error: syntax error, unexpected ‘defined’ (T_STRING) in \\WDP\DFS\41\4\6\5\4184939564\user\sites\1987996.site\www\dev1\wp-content\plugins\bopnavsearchwidget.php on line 9

    Did I do something wrong? It’s just in the main directory of the plugins:
    https://prntscr.com/9w5aaw

    Plugin Author joe_bopper

    (@joe_bopper)

    Hi Sam,

    I can’t say what the issue is as I can’t see the code. It seems you must have another line of code or so between the plugin data comments and the code in the link as it is saying “defined” – the very first bit of the script – is coming through as an unexpected string. You may have missed a semi-colon or closing speech mark at the end of line 6?

    Cheers,
    Joe

    Thread Starter S R

    (@the-goshorn-9)

    Hi Joe,

    I didn’t add anything to the code you gave me other than the header.
    https://www.codesend.com/view/061adc5ea4ac603d9f4b7a8f92ab434b/

    I need to have the Bop Nav Search for Menu enabled already, right?

    Plugin Author joe_bopper

    (@joe_bopper)

    Hi Sam,

    Does it look like this?

    <?php
    /*
    Plugin Name: My Search Widget Plugin
    */
    
    //Reject if accessed directly
    defined( 'ABSPATH' ) || die( 'Our survey says: ... X.' );
    .
    .
    .

    I’ve got it working on my local machine (it doesn’t look good in the 2016 theme), so it’s difficult to know exactly what’s going wrong with yours. A screenshot of what you’ve got up to line 9 might help. Other than that, I haven’t really got any ideas.

    Cheers,
    Joe

    Thread Starter S R

    (@the-goshorn-9)

    Oh, looks like I put the header up above the <?php code instead of below it. That may be the issue…

    Plugin Author joe_bopper

    (@joe_bopper)

    I’m setting this thread as resolved. If this is not the case, please feel free to get back in touch.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Use this plugin in a widget?’ is closed to new replies.