Why are 404s not triggering my 404.php template?

I found that the problem was with the otherwise very useful plugin Legacy URL Forwarding. It uses the following function (abridged here) with the 404_template hook. function doUrlForwarding() { // make a $query based on the $_SERVER[‘REQUEST_URI’] // if a post is found, redirect to it if (!empty($query->post->ID)) { wp_redirect(get_permalink($query->post->ID), ‘301’ ); } } add_action(‘404_template’,’doUrlForwarding’); … Read more

new page sidebar-template by default

I would hook into the new_page action, and then use update_post_meta() to update the post meta value for _wp_page_template: <?php function wpse31124_set_page_default_template( $page_id ) { update_post_meta( $page_id, ‘_wp_page_template’, ‘sidebar-page.php’ ) } add_action( ‘new_page’, ‘wpse31124_set_page_default_template’ ); ?> You could hook into other actions, but they might stomp on your ability to use the default template. Using … Read more

Query post for ‘selected category’ in archive.php

The easiest way to do this is to simply make a category.php template file, that way you’re not jamming everything into one template with multiple query’s and conditionals. http://codex.wordpress.org/Template_Hierarchy#Category_display It is unclear what you mean by “featured”, do you want an url like http://example.com/portfoliography/architecture to have a select posts at the top? Or do you … Read more

List taxonomy term “Last Name” + “First Name” (taxonomy custom field) in a post loop

So I decided to go another way. I now have the Author’s Full Name as terms in the taxonomy. For the index, for which I need to separate Last Name and First Name, I used PHP string functions. <?php $taxonomy = ‘autores’; $queried_term = get_query_var($taxonomy); $terms = get_terms($taxonomy, ‘slug=’.$queried_term); if ($terms) { echo ‘<div id=”indiceAutores-nav”></div> … Read more