infinite loop on page with comments after changing comments.php and header.php

The article you’re using is quite old, from ~2009. There are much better cleaner ways of doing commenting. As a guide, follow this: http://ottopress.com/2008/wordpress-2-7-comments-enhancements/ This is the definitive guide to implementing Comments post v2.7, and Otto is widely respected in the community. Firstly, your comments code uses have_posts() to check if there are comments, instead … Read more

Custom query does not find pages

This is not the place to use query_posts. query_posts should only be used if you need to change the main loop. There is also no need to reset the query and your missing endif on both loops. I would use get_pages instead of running a new WP_Query. $pages = get_pages(); foreach ( $pages as $page … Read more

Does “Custom Post Type” can have page hierarhy option?

You can set a post type to hierarchical when you register it with register_post_type. Simply set the ‘hierarchical’ argument to true. $args = array( ‘public’ => true, ‘publicly_queryable’ => true, ‘has_archive’ => true, ‘rewrite’ => true, … ‘hierarchical’ => true, … ‘supports’ => array( ‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘comments’,’page-attributes’ ) ); register_post_type(‘my-cpt’,$args);

Custom Portfolio Page

You say you have a page for your portfolio, then go on to say you want posts displayed; confusing. Assume you have a category for posting items into named portfolio. New portfolio items will be posted in the portfolio category. You can take your categories.php page, copy and re-name it categories-portfolio.php, then customize it as … Read more

Add Filter to Ignore a Post/Page or a Number of Post/Pages

you can use pre_get_posts filter hook and set the post__not_in parameter of the query ex: function exclude_from_search_filter($query) { if ( !$query->is_admin && $query->is_search) { $query->set(‘post__not_in’, array(40, 9) ); // id of page or post } return $query; } add_filter( ‘pre_get_posts’, ‘exclude_from_search_filter’ );

How to control display of page lists on sidebar that doesn’t have childrens

I would try replacing your $children definition, using get_page_children() or get_children(): <?php global $post; $children = get_children( array( ‘post_type’ => ‘page’, ‘post_parent’ => $post->ID, ‘post_status’ => ‘publish’ ) ); if ( $children ) { // Code to list child pages goes here } ?> Also, wp_list_pages() will always return a string (either populated or empty), … Read more