Is it possible to isolate and use WordPress functions outside of wordpress

One way to access WordPress core functionality outside of your WordPress directory is to use the following example; <?php require( ‘../path-to-your-wordpress-install/wp-load.php’ ); get_header(); // do your magic here… get_footer(); ?> However converting HTML to WordPress shouldn’t really require you to access WordPress outside of itself. Instead you want to be porting across the clients HTML … Read more

Change Query Arguments (filter) with jQuery/Ajax or PHP?

The permalink structure you’ve described above e.g…./hotels/hamburg/features/sea-face isn’t really something that could be achieved by using custom fields. You would be better off creating a new taxonomy called ‘features’ and populating it with terms like ‘sea-facing’ and any others. In order to do queries for multiple taxonomies I would recommend the excellent Query Multiple Taxonomies … Read more

Fetching review value using wpdb class

You need to add the global $wpdb reference and also add the second parameter required for prepare(): global $wpdb; $post_id = $post->ID; $reviewScore = $wpdb->query( $wpdb->prepare( “SELECT review FROM {$wpdb->prefix}gdsr_data_article WHERE post_id = %d”, $post_id ) );

Insert PHP code in Text

A better, cleaner way to do this would be to use proper string return methods and concatenation. I say this, because you’re trying to put functions that echo content (i.e. the_title() into a variable – this won’t work!!! Instead: $text=”<form><td>Permalink to: “; $text .= get_the_title(); $text .='</td><textarea cols=”85″ rows=”2″ readonly=”readonly” onclick=”select()”/>’; $text .= get_permalink( $id … Read more

Pagination stays on same page for post category

query_posts = _your_doing_it_wrong as soon as you throw in that nasty query_posts you are killing off all the global variables and your paging will not work. change: query_posts( array( ‘post_type’ => ‘fieldtrips’, ‘fieldtripcategory’ => ‘elementary-school-aquifer’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 1 ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); to: … Read more