Support » Plugin: TablePress - Tables in WordPress made easy » Search from another page
Search from another page
-
Hi, I need to search a table from the home page of my site that will not display the full table. They will search for a number and a name and get the results for that row. The full table will not be displayed on any page. Is this possible?
-
Hi,
thanks for your question.
You could probably achieve with two TablePress Extensions:
The “Row Filter” Extension can be used to only show rows that contain a search word in a cell, see http://tablepress.org/extensions/row-filter/
On top of that, there’s the Extension http://tablepress.org/extensions/shortcode-filter-get-parameter/ which allows to populate that search term from a GET parameter of the URL.
With that, you could add a search form to your page, that sends a GET request with the search word to the page that will then contain the search results.Regards,
TobiasHi thanks for your help. I added the extentions and have added a simple seerach form to a page. the code is below. When I search it just dies. Below is the code I am using. This is just a testing site. Am I even close to doing it correctly? I am try to match both a number and a name.
Like 20 and Houston to return the row matching both itemsform action=”http://www.abcwebservice.net/wordpress/table-test/” method=”get”>
<p>
<input type=”search” />
number</p>
<p>
<input type=”search” name=”search” id=”search”>
surname</p>
<p>
<input type=”submit” name=”submit” id=”submit” value=”Submit”>
</p>
</form>Table page
http://www.abcwebservice.net/wordpress/table-testSearch page
http://www.abcwebservice.net/wordpress/searchHi,
that’s a great start already!
We should start simply, with just one filter word. Having two filter words is actually not directly possible with the Extension, but would require PHP code changes.Please try again with this form:
<form action="http://www.abcwebservice.net/wordpress/table-test/" method="get"> <input type="search" name="table_filter" id="search" />surname<br / <input type="submit" name="submit" id="submit" value="Submit"> </form>
Additionally, the page http://www.abcwebservice.net/wordpress/table-test/ should have a Shortcode like
[table_filter id=123 /]
and you need to have both of the Extensions from above installed and activated.
Regards,
TobiasThank you, I have added the form code you sent. Both plugins are installed and activated.
The serch box is here with the form
http://www.abcwebservice.net/wordpress/search/http://www.abcwebservice.net/wordpress/table-test/ has this short code [table_filter id=3 /] and displays the table
but when I try a search i get
Not Found
Apologies, but the page you requested could not be found. Perhaps searching will help.Thanks
TimHi Tim,
it’s almost working. There’ just some invisible characters in the URL.
Please replace the line
<form action="http://www.abcwebservice.net/wordpress/table-test/" method="get">
with this again (I know it looks the same, but it isn’t. There’s an invisible character right before the second
"
), with copy&paste:<form action="http://www.abcwebservice.net/wordpress/table-test/" method="get">
Regards,
TobiasPerfect! Thank you. Ok you said Having two filter words is actually not directly possible with the Extension, but would require PHP code changes. How difficult would this be to do?
Hi,
great to hear that this worked!
The changes are not really complicated, but unfortunately, I’m a little bit busy at the moment. I might be able to make these changes this weekend. If you need them quicker, we could work something out professionally. If you are interested, please send me an email (the address is in the main plugin file “tablepress.php”).
Regards,
Tobias
- The topic ‘Search from another page’ is closed to new replies.