Remove ID page from wp_count

This should work for you to exclude via ID: //replace the 3,8 with your page ids <?php $args=array( ‘post__not_in’ => array(3,8), ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ); query_posts($args); ?> If you want to exclude via page title you can do this <?php $exclude1 = get_page_by_title(‘Sample Page Title’); ?> <?php $exclude2 = get_page_by_title(‘Sample Page Title … Read more

WordPress category widget only show categories with children

I would suggest something like this: function exclude_widget_subcategories($args){ $all_categories = get_terms(‘category’, array(‘parent’ => 0, ‘fields’ => ‘ids’)); $exclude_categories = array(); foreach($all_categories as $category_id){ $children = get_term_children($category_id, ‘category’); if(count($children)!=0){ $exclude_categories[] = $category_id; } } $exclude = implode(“,”,$exclude_categories); // The IDs of the excluding categories $args[“exclude”] = $exclude; return $args; } add_filter(“widget_categories_args”,”exclude_widget_subcategories”); get_terms(‘category’, array(‘parent’ => 0, ‘fields’ … Read more

Exclude featured image and custom field from this get_attachment query

The asker refused to post his solution as answer, so I took the liberty to get this question out of our growing Unanswered Questions list … <?php $logo = get_post_meta($post->ID, ‘_lm_comm_logo’, true); $map = get_post_meta($post->ID, ‘_lm_comm_map’, true); $args = array( ‘numberposts’ => -1, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, … Read more

Exclude featured image from gallery code stops Lightbox from working

I solved this by using this code function exclude_thumbnail_from_gallery($null, $attr) { if (!$thumbnail_ID = get_post_thumbnail_id()) return $null; // no point carrying on if no thumbnail ID // temporarily remove the filter, otherwise endless loop! remove_filter(‘post_gallery’, ‘exclude_thumbnail_from_gallery’); // pop in our excluded thumbnail if (!isset($attr[‘exclude’]) || empty($attr[‘exclude’])) $attr[‘exclude’] = array($thumbnail_ID); elseif (is_array($attr[‘exclude’])) $attr[‘exclude’][] = $thumbnail_ID; // … Read more

Exclude category from fucntion

foreach ($categories as $individual_category) { if( $individual_category->term_id == 81 || $individual_category->term_id == 82 ) continue; $category_ids[] = $individual_category->term_id; } explanation: the above replaces: foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id; i.e. the code jumps over the to be excluded categories.

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