Code Duplication    Length = 7-7 lines in 2 locations

geodirectory-functions/taxonomy_functions.php 1 location

@@ 464-470 (lines=7) @@
461
    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
462
463
    $stype = false;
464
    foreach ( $post_types as $post_type => $info ) {
465
        global $wpdb;
466
        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
467
        if ( $has_posts ) {
468
            $stype = $post_type; break;
469
        }
470
    }
471
472
    if(!$stype){
473
        $stype = 'gd_place';

geodirectory-functions/custom_functions.php 1 location

@@ 2319-2325 (lines=7) @@
2316
2317
	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2318
2319
		foreach ( $post_types as $post_type => $info ){
2320
			global $wpdb;
2321
			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2322
			if ( ! $has_posts ) {
2323
				unset($post_types->{$post_type});
2324
			}
2325
		}
2326
2327
		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2328