streamweaver
Forum Replies Created
-
Forum: Plugins
In reply to: Using wordpress for custom database queries?Sorry for the ping-pong here. I understand that gives me a function but I’m still at a loss as to how to call it.
What I want is a file called ejsearch.php that I can pass some variables to that have nothing really do do with wordpress and it will query some tables in the database that are not a part of wordpress. I want to take the results of that query and display them on that page.
I’d like to do this using the wordpress DB class and displayed using my wordpress theme.
In the example you just gave I would need to be calling some wordpress query like a page number or something (if I understand it right anyway). I suppose I could just make a blank page in wp and don’t include any of the loop returns, instead returning my own functions and assign that page the template with those functions. That’s pretty hacky though and if I were to every transfer out I don’t want to be dependent on a wordpress URL (i.e. having to include the pagecall to a non-existant page).
Forum: Plugins
In reply to: Using wordpress for custom database queries?I’m sorry if I’m confusing things or not descirbing them right and appreciate the help. That works fine, I generally understand the php coding by my problem comes in tryign to tie everything together within the site for for instance.
if file ejsearch.php under the blog root contains:`require(‘./wp-blog-header.php’);
function testme () {
global $wpdb;
$result = $wpdb->get_var(“SELECT count(*) FROM wp_posts”);
echo “<h1>”.$result.”</h1>”;
}testme();`
I get my number of posts back just fine, it’s connecting to the DB and the code seems to work well.
My problem is that I want to include this return within the template I’m using in wordpress. That seems to happen by including the line:
define('WP_USE_THEMES', true);
above the ‘require’ line in the above code.When I do this though it loads my theme home.php instead and gives me no return.
Thanks again for the help and sorry if I’m being thick headed.
Forum: Plugins
In reply to: Using wordpress for custom database queries?Thanks. That’s all pretty straight forward and I want to use that for my DB calls. The DB layer I used previously uses very similar functions so I can port my stuff over pretty easily.
My problem is where do I call these functions? I used to have a page called search.php that my form submitted to or querystring went to but I’m confused as to how I would replicate this in wordpress.
I tried making a new page called ejsearch.php under the root directory and including the short code from the wp index.php file but if I don’t pass it a function wp recognizes it loads my home.php from the template.
Again this doesn’t seem to be a candidate for a plugin.