Set WordPress Default Template

The better, cleaner solution would be not to use custom page templates to define page layouts*, but rather to use custom post meta to define page layouts. To implement: Create a Theme Option for Default static page layout, that includes all possible page layout options Create a _page_layout custom post meta for Page Layout, that … Read more

Can I change header.php of current theme through a plugin function?

If you are looking to insert code into the <head></head> block, then this hook does it: add_action( ‘wp_head’, ‘wpse_73900_wp_head’ ); function wpse_73900_wp_head() { ?> <!– Custom Html —> <?php } If that’s not the case, then it’s more difficult. I think it would depend on the theme providing a hook at your desired point of … Read more

Find the Children of a Page then Echo it as a Bulleted List of Links (menu)

Well you just need to run a foreach loop over your $children but WordPress has a build in function for this already called wp list pages. For example: $children = wp_list_pages(‘title_li=&child_of=”.$post->ID.”&echo=1’); if ($children) echo ‘<ul>’ . $children . ‘</ul>’; There is a full reference and examples here: http://codex.wordpress.org/Function_Reference/wp_list_pages

WordPress with broken paging page 3

Ok, Now this is particularly very odd…I found this forum post: http://wordpress.org/support/topic/error-404-on-pagination-when-changing-posts_per_page-on-query_posts Which basically says that if you are restricting the number of posts to a number less than 10 (which is the WordPress default), sometimes it can break pagination. To fix this issue, all you have to do is set the default number to … Read more

How can I let templates choose which stylesheets are enqueued?

Check the current template in your callback. This is a post meta field named _wp_page_template. add_action(“wp_enqueue_scripts”, function() { // This stylesheet is used on *every* page wp_register_style(“sitewide”, get_template_directory_uri() . “/assets/sitewide.css”); wp_enqueue_style(“sitewide”); if ( ! is_singular() ) return; $template = get_post_meta( get_the_ID(), ‘_wp_page_template’, TRUE ); // now enqueue further stylesheets depending on the current template });