Exclude pages by menu order

Declare the following function in your functions.php function wpse58346_wp_list_pages( $pages, $r ) { foreach( $pages as $key => $page ) { if ( 50 < $page->menu_order ) unset($pages[$key]); } return $pages; } Now before calling wp_list_pages() apply a filter as follows add_filter(‘get_pages’, ‘wpse58346_wp_list_pages’, ”, 2); And after you have called wp_list_pages() you can remove the … Read more

How do I remove a category from a wordpress loop>

You can add category id or category slug into arguments you are passing to query_posts: <?php // category slug (‘products’) query_posts(array( ‘post_type’ => ‘post’, ‘showposts’ => 5, ‘category_name’ => ‘products’ ) ); ?> or <?php // category id (‘3’) query_posts(array( ‘post_type’ => ‘post’, ‘showposts’ => 5, ‘cat’ => ‘3’ ) ); ?> In the second … Read more

How to exclude Sticky from Recent Post?

You can try this: $args = array( ‘post__not_in’ => get_option( ‘sticky_posts’ ), ‘posts_per_page’ => 5, ); $recent = new WP_Query( $args ); to exclude the sticky posts. You can read more about it here in the Codex.

Exclude taxonomy term from all loops, but having it on widget

Looks like you’ve excluded a taxonomy term, not the whole taxonomy. Is that what you intended? But on to the answer… Right before your query in the widget add: remove_action( ‘pre_get_posts’, ‘exclude_category_posts’ ); And then you probably want to put it back again after that query by repeating: add_action( ‘pre_get_posts’, ‘exclude_category_posts’ ); That is a … Read more

Weird string offset errors when displaying post attachments

Since you’ve used the true argument for get_post_meta, $blogimages will be a single array, not a multidimensional one. So instead of $blogimages[0][‘blog-image-inside’], just use $blogimages[‘blog-image-inside’]. For absolute sanity, you might also want to check $blogimages before you use it: ‘exclude’ => [ $thumb_ID, isset( $blogimages[‘blog-image-inside’] ) ? $blogimages[‘blog-image-inside’] : 0, isset( $blogimages[‘blog-image-front’] ) ? $blogimages[‘blog-image-front’] … Read more

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