Posts archive index pagination in a static page custom query

When you perform a custom query such as this one, you have to do a bit of a “hack” to get pagination to work properly. Change this: <?php query_posts( “category_name=news&orderby=date&order=ASC&posts_per_page=2” ); ?> …to a WP_Query call: <?php $news_query = new WP_Query( “category_name=news&orderby=date&order=ASC&posts_per_page=2” ); ?> And then you need to *move your custom query object into … Read more

How to show a post single post in page template

The »Template Hierarchy« doesn’t allow this per default. Inside your single.php template, you can call load_template(). This will allow you to simply include the template you need, based on the in_category() conditional tag. // inside single.php if ( in_category( ‘foo’ ) ) { load_template( get_stylesheet_directory().’foo_template.php’ ); } elseif ( in_category( ‘bar’ ) ) { load_template( … Read more

What content should go in index.php?

Index.php isn’t for a specific page, and that’s not how template files in themes work. You will need to understand the template heirarchy http://codex.wordpress.org/Template_Hierarchy WordPress uses the Query String — information contained within each link on your web site — to decide which template or set of templates will be used to display the page. … Read more

Dynamically assign same page template to child page as parent

Paste following code to your theme’s functions.php: add_action(‘save_post’,’changeTemplateOnSave’); function changeTemplateOnSave(){ global $post; $curr_tmp = get_post_meta($post->ID, ‘_wp_page_template’, true); $parent_tmp = get_post_meta($post->post_parent, ‘_wp_page_template’, true); if($post->post_parent) update_post_meta($post->ID,’_wp_page_template’,$parent_tmp,$curr_tmp); } This will force WordPress to change page template to it’s parent template on post save. Not tested but should work.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)