page_template toggle between 2 templates + 2 permalinks for same post

WordPress has a simpler function for what you’re trying to do, add_rewrite_endpoint. Additionally, the filter for a single post template is single_template, page_template fires on the page post type. function wpd_detail_endpoint(){ add_rewrite_endpoint( ‘detail’, EP_PERMALINK ); } add_action( ‘init’, ‘wpd_detail_endpoint’ ); function wpd_detail_template( $template=”” ) { global $wp_query; if( ! array_key_exists( ‘detail’, $wp_query->query_vars ) ) return … Read more

Query posts by custom post type and custom taxonomy

Pretty sure you can’t match multiple taxonomy terms in a query–Wordpress will only honor the first one and ignore the rest. Apparently, this is scheduled to be fixed in 3.1. In the meantime, there is a plugin that’ll fix you right up: http://scribu.net/wordpress/query-multiple-taxonomies EDIT: If you want a non-plugin solution, let me know. I’ve got … Read more

Settings API erases itself?

The reason is that if you are on page 1, the data that is posted to be saved is an array of the form: XX_theme_settings=array(‘XX_Option1′ =>’input1′,’XX_Option2’=>’input2′,…) and contains no data from page 2. This is because the input from page 2 is not posted with it (since it wasn’t in the same <form> – it’s … Read more

Change post title during post saving process

You can hook into wp_insert_post_data and change things. <?php add_filter(‘wp_insert_post_data’, ‘wpse67262_change_title’); function wpse67262_change_title($data) { $data[‘post_title’] = ‘This will change the title’; return $data; } Obviously you’re going to have to some checks and stuff so you don’t change every post title. That hook will also fire every time the post is saved (adding a new … Read more

How to add a select menu to this metabox code?

Basically you need to add the html of the select dropdown at your function inventory_information() which is the function that actually displays the metabox: // The Event Location Metabox function inventory_information() { global $post; // Noncename needed to verify where the data originated echo ‘<input type=”hidden” name=”inventorymeta_noncename” id=”inventorymeta_noncename” value=”‘ . wp_create_nonce( plugin_basename(__FILE__) ) . ‘” … Read more