Search results to be only posts & children of page ID

The only way I could figure it out was to build a list of ID’s to exclude like this: /* * Hide some pages from search results */ function SearchFilter($query) { if ($query->is_search) { $exclude=”18,20,12,22,132,76,81,78,84,91″; // Get all children of #18 $pages = get_pages(‘post_parent=18’); foreach($pages as $child) { $exclude .= “,” . $child->ID; } $query->set(‘post__not_in’, … Read more

Exclude category from drop down list form

try: <?php $cat_to_EXCLUDE = 50; $cate_id = retrieve_cat_data(true); $cate_name = retrieve_cat_data(false); for ($i = 0; $i < count($cate_name); $i++ ) { ?> if ($cate_id[$i] != $cat_to_EXCLUDE){ <option value=”<?php echo $cate_id[$i]; ?>”><?php echo $cate_name[$i]; ?> </option><?php }} ?> update: if you search your theme’s functions.php file i bet you will find a function named retrieve_cat_data anyway … Read more

Exclude child pages args array

There is not depth parameter for get_posts. See http://codex.wordpress.org/Template_Tags/get_posts You will need to check to see whether the page has a parent and display it if it does not have a parent. Once you are in the foreach loop add an if statement <?php if( !$post->parent ): ?> <li><a href=”https://wordpress.stackexchange.com/questions/26866/<?php the_permalink(); ?>” title=”<?php the_title(); ?>”> … Read more

How can I exclude a category from the main loop with the category name & not ID?

You directly cannot pass the name or slug for excluding a particular category. You have to use the id. Modifying your code: <?php $category_id = get_cat_ID(‘featured’); //if get_query_var(‘paged’) doesn’t work, then try using get_query_var(‘page’) in the next line. $paged = (get_query_var(‘paged’))?get_query_var(‘paged’):1; $q = array(); $q[‘category__not_in’] = array($category_id); $q[‘paged’] = $paged; query_posts($q); if (have_posts()) : while … Read more

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