Apache Redirect based on WordPress permissions

What you’re describing is likely best done in a simple WordPress plugin. You’re user roles are already stored in WordPress, so a plugin to do this is likely only a few lines long. Also an existing plugin like File Away may accomplish what your attempting. This plugin surfaced when I did a plugin search for … Read more

Can I use mysql queries to replace query_posts()?

It’s not clear what do you mean by template “accepting” variables. WP_Query (which query_posts()/get_posts() are build on top of) is very flexible. In many cases it’s not as much being able to do something with it, as having experience using it to achieve results. Typically even when queries cannot be expressed in single set of … Read more

MySQL Select within WP Page template

@Adrian, You don’t really need to assign anything to variables. You already have the information, you just need to loop through it and add the required HTML as you wish. If you actually want to use a table you can do something similar to: <table> <?php $myrows = $wpdb->get_results( “SELECT first_name, surname FROM members” ); … Read more

Geographical proximity query using post_meta

Oh dear, that was extremely obvious – there was a missing closing bracket! Here is the working query. SELECT ID, ( 6371 * acos ( cos ( radians( 35.665833 ) ) * cos( radians( latitude.meta_value ) ) * cos( radians( longitude.meta_value ) – radians( 139.731111 ) ) + sin ( radians(35.665833 ) ) * sin( … Read more

MySQL – How to combine data from two tables into one?

Syntax The issue with your WordPress approach is the get_var calls used to get the subscriber id and interest name. get_var is intended to get just a variable from the database like the number of rows in the table or sum of a numeric column in the table, see the WordPress Codex What your looking … Read more

How to get Attachments(image) with specific width\height ratio

The _wp_attachment_metadata stores serialized data. It’s not meant to be used directly in queries to match results. Instead hook add_attachment action and store original image’s dimensions into separate post meta properties. After you’re happy with how it works follow Rarst’s advice and find a way to walk all existent image attachments and generate those meta … Read more