Modifying WP URL handing code?

I ended up solving this with a little bit of code (in the form of a plugin): if(isset($_GET[‘state’]) OR isset($_GET[‘city’])) { $url = explode(“https://wordpress.stackexchange.com/”, $_SERVER[‘REQUEST_URI’]); $url = end($url); $_SERVER[‘REQUEST_URI’] = “https://wordpress.stackexchange.com/” . $url; } This code in essence removes the “/arizona/” or “/arizona/phoenix/” from the REQUEST_URI global variable and replaces it with “https://wordpress.stackexchange.com/”, which then … Read more

Why is home page content not displaying with this rewrite rule?

I suppose you’ve forgotten the QSA directive, to add properly the query string: RewriteEngine On RewriteBase / RewriteRule ^(\w+)/$ /index.php?state=$1 [QSA,L] RewriteRule ^index\.php$ – [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [QSA,L] Tell me if it works, and if not, I’ll do my best to answer. Two hints: Please try to use … Read more

WP_Query and help with the loop for magazine front page

There is no reason to need 2 loops or to alter the query in any way if your are just showing the 9 most recent posts. You can use a loop counter to create the extra divs you need. <div id=”featured”> <?php $count = 0; if (have_posts()) : while (have_posts()) : the_post(); $count++; if ( … Read more

Display metabox title for custom fields with values

You can add another simple foreach loop to check if you have any values first: foreach ( $meta_boxes as $metabox ) { $has_value = false foreach ( $metabox[‘fields’] as $field ) { $meta = get_post_meta($post->ID, $field[‘id’], true); if(!isset($meta[0])){ $need_title = true; break; } } if ($has_value){ echo $metabox[‘title’]; foreach ( $metabox[‘fields’] as $field ) { … Read more

PHP variables in a post?

By default, PHP is stripped out of the posts content. You can use this plugin to aleivate this: http://wordpress.org/extend/plugins/exec-php/ This will give you a quick, easy fix to be able to do it the way you are trying to. I would suggest reading http://codex.wordpress.org/Custom_Fields for the more proper way to do this though.

Why doesn’t update_post_meta work for certain strings?

Check closely on your line: With the $path = $upload[‘file’] call I get that $path contains “C:\xampp\htdocs\wordpress/wp-content/uploads/2011/12/ReSharper-6.1-License18.txt” ‘\’ changes to “https://wordpress.stackexchange.com/” just after the ‘wordpress’ i.e. \wordpress/, hence invalidating your path. But when you use a hard coded path (which is not invalid), you get the answer. Try fixing your path first.

making my own “related pages” / “pages you might like” section

Function Reference/get the tags « WordPress Codex Class Reference/WP Query « WordPress Codex#Tag_Parameters add some code like this to content-single.php of your child theme of Twenty Eleven: $tags = array(); $posttags = get_the_tags(); if( $posttags ) : foreach( $posttags as $tag ) { $tags[] = $tag->term_id; } $related_query = new WP_Query( array(‘tag__in’ => $tags)); if( … Read more