What difference does it make if I use index.php as HTML wireframe versus writing each main template file as a full HTML document?

Option 2 is the best option. To know why, one needs to look at the template loader. (The template hierarchy means nothing, if you do not know how it really works or come from) if ( defined(‘WP_USE_THEMES’) && WP_USE_THEMES ) : 59 $template = false; 60 if ( is_404() && $template = get_404_template() ) : … Read more

Customize WordPress>Error Page

You’re probably talking about theming wp_die(), which is the function that produces those grey error pages with a white box of text in them. For a plugin solution, you could try this plugin, which says it does what you want. Not sure about version support though–it says it only works up to 3.1.4. For a … Read more

Auto get_header and get_footer on every template?

Looking at wp-includes/template-loader.php … there seems to be a way: if ( $template = apply_filters( ‘template_include’, $template ) ) include( $template ); You could hook into that filter, handle the including in a callback function and return FALSE. Sample code, not tested: add_filter( ‘template_include’, function( $template ) { get_header(); include $template; get_footer(); return FALSE; });

How to add a checkbox element to attachments editor with example

Set the ‘input’ to ‘html’ and write out the html for the input: function filter_attachment_fields_to_edit( $form_fields, $post ) { $foo = (bool) get_post_meta($post->ID, ‘foo’, true); $form_fields[‘foo’] = array( ‘label’ => ‘Is Foo’, ‘input’ => ‘html’, ‘html’ => ‘<label for=”attachments-‘.$post->ID.’-foo”> ‘. ‘<input type=”checkbox” id=”attachments-‘.$post->ID.’-foo” name=”attachments[‘.$post->ID.’][foo]” value=”1″‘.($foo ? ‘ checked=”checked”‘ : ”).’ /> Yes</label> ‘, ‘value’ => … Read more

My child theme doesn’t work Error: “The parent theme is missing. Please install your parent theme”

There are three things to check: Is your parent theme complete and what is the exact spelling of the parent theme’s name in its style.css. Uppercase and lowercase are important. Is the child theme directory named parentname-child. It should be in the themes directory, not in a subdirectory of the parent theme. Does the child … Read more

Are content.php and content-single.php the same?

No, content.php and content-single.php are not the same thing. In your example CODE: if (get_post_format() == false) { get_template_part(‘content’, ‘single’); } else { get_template_part(‘content’, get_post_format()); } WordPress will load content-single.php when get_post_format() is false. However, get_template_part( $slug, $name ) may still try to load content.php when you call it with get_template_part(‘content’, get_post_format()); in the following … Read more