you mean something like this?
global $wpdb;
$test = $wpdb->get_results(
$wpdb->prepare("SELECT * FROM testtable"),
ARRAY_A
);
foreach ($test as $testrow) {
$therow = get_post($testrow['postid']);
print_r($therow);
}
Is there a way to include this in the search of standard WordPress ?
to be exact : if i use the standard search of wordpress i want the output of the custom table to be in the reults.
Theres always a way when you have access to the source code
But off the top of my head you would need to do a mysql join in the query that the search form uses.
Unfortunately Ive never done a mysql join so not sure how to go about it
extra (custom) table contains the post_id so the record(s) can be linked the a particular post.
Are there plugins witch incorporate their data into the search of wordpress ? maybe i can use these plugins as an example.
i just found http://codex.wordpress.org/Custom_Queries
Theres a section covering Keyword search in plugin table.
however : i tried to follow the directions (example).
It is not clear to me where to put the code.
can anyone explain how this works ?
Still no awnser from anyone. Im I really the first one to make wordpress search custom tables ?? Theme must be someone with some search experience
I have no experience with custom tables, but the code examples from the Custom Queries page can be placed in either the functions.php file of your theme or child theme, or you can place the code in your own plugin.
For more complex SQL queries, I prefer to use $wpdb methods that accept raw SQL query syntax. It’s easier to find generic SQL query examples that work than trying to figure out what WP_Query does with your arguments.