Jump to content

PHP code in Wordpress


kathrynmichaud

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!
 
Link to comment
https://forums.phpfreaks.com/topic/289000-php-code-in-wordpress/
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>

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

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.