get( 'cat' ) ) ) { // For each child, add just the ID to an array foreach ( $excludes as $key => $value ) { $exs[] = $value->term_taxonomy_id; } } // If array exists, remove posts in child categories from query. if ( isset( $exs ) && is_array( $exs ) ) { // WP Query changed in 3.1 if ( version_compare( $wp_version, 3.1, '<' ) ) $where .= " AND " . $wpdb->prefix . "term_taxonomy.term_id NOT IN ( ". implode( ",", $exs ) . " ) "; else $where .= " AND " . $wpdb->prefix . "term_relationships.term_taxonomy_id NOT IN ( ". implode( ",", $exs ) . " ) "; } } return $where; } /** * Removes the filter after the main query has been built to not interfere with widgets * * @since 0.4 */ function ft_nscp_remove_filter() { remove_filter( 'posts_where', 'ft_nscp_mod_where' ); } if ( ! is_admin() ) { add_filter( 'posts_where', 'ft_nscp_mod_where' ); add_action( 'template_redirect', 'ft_nscp_remove_filter' ); } /** * Adds ability to donate to plugin development * * @since 0.4 */ function ft_ncsp_donate() { // Kill notice if ( isset( $_GET['remove_ncsp_donate'] ) ) update_option( 'ft_ncsp_show_donate', '0.4' ); // Look for wp_option if ( ! $show_donation_link = get_option( 'ft_ncsp_show_donate' ) ) { update_option( 'ft_nscp_show_donate', 'yes' ); $show_donation_link = 'yes'; } if ( 'yes' == $show_donation_link ) add_action( 'admin_notices', 'ft_ncsp_donate_notice' ); } add_action( 'admin_init', 'ft_ncsp_donate' ); /** * This displays the option to donate via paypal * * @since 0.4 */ function ft_ncsp_donate_notice() { $paypal_link = 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8'; $no_thanks = esc_url( admin_url( 'plugins.php?remove_ncsp_donate=true' ) ); echo "
" . sprintf( __( "Thanks for upgrading the 'No subcats in loops' plugin. Would you consider sending the developer $5.00 USD to sustain development? Yes, take me to PayPal | No thanks | I already did." ), $paypal_link, $no_thanks, $no_thanks ) . "
"; }