Jump to content
kathrynmichaud

PHP code in Wordpress

Recommended Posts

Hi - I'm using the WP Job Boards plugin for Wordpress.  I've been given this code to create a quick search form to place in a widget.  I've tried to paste the code in a sidebar widget and apparently after somebody inputs the keyword and location they should be sent to the results page which will show their results, however, it's not doing that, just showing me a 'page cannot be found' result.

 

Can anybody help me out with correcting the code?

 

<form action="<?php esc_attr_e(wpjb_link_to("http://www.littlefoxwebdesign.co.uk/etsgroup/jobs")) ?>" method="GET">
Keyword: <input type="text" name="query" value="" /><br/>
Location: <input type="text" name="location" value="" /></br/>
<input type="submit" value="Search" />
</form>
 
Thank you!
 

Share this post


Link to post
Share on other sites

Is the widget you are using capable of parsing php code?

You can try something like this and the code below

https://wordpress.org/plugins/php-text-widget/

<form action="<?php esc_attr_e(wpjb_link_to("http://www.littlefoxwebdesign.co.uk/etsgroup/jobs"));?>" method="GET">
Keyword: <input type="text" name="query" value="" /><br/>
Location: <input type="text" name="location" value="" /></br/>
<input type="submit" value="Search" />
</form>
Edited by QuickOldCar

Share this post


Link to post
Share on other sites

When viewing the page in your browser, have you looked at the source code for the page? Does it look like the value for action attribute was interpreted correctly?

Share this post


Link to post
Share on other sites

When viewing the page in your browser, have you looked at the source code for the page? Does it look like the value for action attribute was interpreted correctly?

It shows as

<div class="textwidget"><form action="<?php esc_attr_e(wpjb_link_to("search")) ?>" method="GET">

so not parsing the php

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.