bar' => ' > ' . __( 'Sidebar', 'us' ), 'content' => '', 'footer' => ' > ' . __( 'Footer', 'us' ), ); foreach ( $ids as $id ) { $used_in[ $id ] = array( 'theme_options' => array(), 'singulars_meta' => array(), 'singulars_content' => array(), 'nav_menu_item' => array(), ); $results[ $id ] = ''; $posts_types[ $id ] = get_post_type( $id ); } // Theme Options > Pages Layout foreach ( us_get_public_post_types( array( 'product' ) ) as $type => $title ) { // Fix suffixes regarding historical theme options names switch ( $type ) { case 'page': $type = ''; break; case 'us_portfolio': $type = '_portfolio'; break; default: $type = '_' . $type; break; } $link_atts = array( 'href' => admin_url( 'admin.php?page=us-theme-options#pages_layout' ), 'rel' => 'noopener', 'target' => '_blank', ); $edit_link = ' (' . __( 'edit in Theme Options', 'us' ) . ')'; foreach ( $ids as $id ) { foreach ( $areas as $area => $area_name ) { if ( isset( $usof_options[ $area . $type . '_id' ] ) AND $usof_options[ $area . $type . '_id' ] == $id ) { $used_in[ $id ]['theme_options'][] = '
' . $title . $area_name . '' . $edit_link; } } } } // Theme Options > Archives Layout $archives_layout_types = array_merge( array( 'archive' => us_translate( 'Archives' ), 'author' => __( 'Authors', 'us' ), ), us_get_taxonomies( TRUE, FALSE, 'woocommerce_exclude' ) ); foreach ( $archives_layout_types as $type => $title ) { if ( ! in_array( $type, array( 'archive', 'author' ) ) ) { $type = 'tax_' . $type; } $link_atts = array( 'href' => admin_url( 'admin.php?page=us-theme-options#archives_layout' ), 'rel' => 'noopener', 'target' => '_blank', ); $edit_link = ' (' . __( 'edit in Theme Options', 'us' ) . ')
'; foreach ( $ids as $id ) { foreach ( $areas as $area => $area_name ) { if ( isset( $usof_options[ $area . '_' . $type . '_id' ] ) AND $usof_options[ $area . '_' . $type . '_id' ] == $id ) { $used_in[ $id ]['theme_options'][] = '
' . $title . $area_name . '' . $edit_link; } } } } // Theme Options > Shop if ( class_exists( 'woocommerce' ) ) { $woocommerce_types = array_merge( array( 'product' => us_translate( 'Products', 'woocommerce' ), 'shop' => us_translate( 'Shop Page', 'woocommerce' ), ), us_get_taxonomies( TRUE, FALSE, 'woocommerce_only' ) ); $link_atts = array( 'href' => admin_url( 'admin.php?page=us-theme-options#woocommerce' ), 'rel' => 'noopener', 'target' => '_blank', ); $edit_link = ' (' . __( 'edit in Theme Options', 'us' ) . ')
'; foreach ( $woocommerce_types as $type => $title ) { if ( ! in_array( $type, array( 'product', 'shop' ) ) ) { $type = 'tax_' . $type; } foreach ( $ids as $id ) { foreach ( $areas as $area => $area_name ) { if ( isset( $usof_options[ $area . '_' . $type . '_id' ] ) AND $usof_options[ $area . '_' . $type . '_id' ] == $id ) { $used_in[ $id ]['theme_options'][] = '
' . $title . $area_name . '' . $edit_link; } } } } } // Append locations to result string foreach ( $ids as $id ) { $results[ $id ] .= implode( $used_in[ $id ]['theme_options'] ); } // Singulars (metabox) if ( ! empty( $areas ) ) { $usage_meta_keys = array_map( function ( $area ) { return sprintf( 'us_%s_id', $area ); }, array_keys( $areas ) ); $query = " SELECT pm.post_id, pm.meta_key, pm.meta_value, p.post_title FROM {$wpdb->postmeta} AS pm LEFT JOIN {$wpdb->posts} AS p ON pm.post_id = p.ID WHERE pm.meta_value IN( '" . implode( "','", $ids ) . "' ) AND pm.meta_key IN( '" . implode( "','", $usage_meta_keys ) . "' )"; // Iterate queries us_iterate_queries( $query, function ( $items ) use ( &$used_in, $areas ) { foreach ( $items as $item ) { if ( is_null( $item->post_title ) OR ! us_is_post_visible_for_curr_lang( $item->post_id, $item->meta_value ) ) { continue; } // Get post title $post_title = empty( $item->post_title ) ? us_translate( '(no title)' ) : $item->post_title; // Get post link atts $link_atts = array( 'href' => us_get_edit_post_link( $item->post_id ), 'rel' => 'noopener', 'target' => '_blank', 'title' => us_translate( 'View Page' ), ); $used_in[ $item->meta_value ]['singulars_meta'][] = '
' . $post_title . '' . us_arr_path( $areas, $item->meta_key, '' ) . '
'; } } ); } // Append locations to result string foreach ( $ids as $id ) { $results[ $id ] .= implode( $used_in[ $id ]['singulars_meta'] ); } // Singulars (content) $meta_value_like = ''; foreach ( $ids as $id ) { if ( ! empty( $meta_value_like ) ) { $meta_value_like .= ' OR'; } $meta_value_like .= " meta_value LIKE '%" . $id . "%'"; } $query = " SELECT pm.post_id, pm.meta_value, p.post_title, p.post_type FROM {$wpdb->postmeta} AS pm LEFT JOIN {$wpdb->posts} AS p ON pm.post_id = p.ID WHERE meta_key = '_us_in_content_ids' AND ({$meta_value_like}) "; // Iterate queries us_iterate_queries( $query, function ( $items ) use ( &$used_in, $ids, $posts_types ) { foreach ( $items as $item ) { if ( ! $post_id = $item->post_id ) { continue; } $meta_value_ids = explode( ',', $item->meta_value ); foreach ( $ids as $id ) { if ( in_array( $id, $meta_value_ids ) AND us_is_post_visible_for_curr_lang( $post_id, $id ) ) { $used_in[ $id ]['singulars_content'][ $post_id ] = array( 'url' => us_get_edit_post_link( $post_id ), 'edit_url' => us_get_edit_post_link( $post_id, $item->post_type ), 'title' => empty( $item->post_title ) ? us_translate( '(no title)' ) : $item->post_title, 'post_type' => ! empty( $posts_types[ $id ] ) ? $posts_types[ $id ] : NULL, ); } } } } ); // Append locations to result string foreach ( $ids as $id ) { if ( ! empty( $used_in[ $id ] ) AND ! empty( $used_in[ $id ]['singulars_content'] ) ) { foreach ( $used_in[ $id ]['singulars_content'] as $location ) { switch ( $location['post_type'] ) { case 'us_page_block': $url = $location['edit_url']; $title = __( 'Edit Page Block', 'us' ); break; case 'us_content_template': $url = $location['edit_url']; $title = __( 'Edit Content template', 'us' ); break; default: $url = $location['url']; $title = us_translate( 'View Page' ); break; } $link_atts = array( 'href' => $url, 'rel' => 'noopener', 'target' => '_blank', 'title' => $title, ); $results[ $id ] .= '
' . $location['title'] . '
'; } } } // Widgets (for Grid Layouts only) $regexp_layouts = array(); foreach ( $ids as $id ) { $regexp_layouts[] = strlen( $id ) . ':"' . $id; } $regexp_layouts = implode( '|', $regexp_layouts ); $query = " SELECT `option_name`, `option_value` FROM {$wpdb->options} WHERE option_name LIKE 'widget%' AND option_value REGEXP '\"layout\";s:({$regexp_layouts})\"' LIMIT 0, 100"; if ( $widget_options = $wpdb->get_results( $query ) ) { global $wp_registered_sidebars, $wp_registered_widgets; $_widget_titles = $_sidebars_widgets = array(); // Get widget_id => Sidebar name foreach ( wp_get_sidebars_widgets() as $sidebar_id => $widget_ids ) { if ( $sidebar_id === 'wp_inactive_widgets' OR ! isset( $wp_registered_sidebars[ $sidebar_id ] ) ) { continue; } $_sidebars_widgets = array_merge( $_sidebars_widgets, array_fill_keys( array_values( $widget_ids ), $wp_registered_sidebars[ $sidebar_id ]['name'] ) ); } // Get widget name foreach ( $wp_registered_widgets as $base_id => $widget ) { foreach ( $widget['callback'] as $callback ) { if ( isset( $callback->option_name, $_sidebars_widgets[ $base_id ] ) ) { $number = substr( $base_id, mb_strlen( $callback->id_base . '-' ) ); $_widget_titles[ $callback->option_name ][ $number ] = [ 'sidebar_name' => $_sidebars_widgets[ $base_id ], 'name' => $callback->name, ]; } } } unset( $_sidebars_widgets ); // Creating links for widgets foreach ( $widget_options as $usage_result ) { foreach ( $ids as $id ) { foreach ( unserialize( $usage_result->option_value ) as $number => $value ) { if ( ! is_array( $value ) OR ! isset( $value['layout'] ) OR $value['layout'] != $id ) { continue; } $_widget = isset( $_widget_titles[ $usage_result->option_name ][ $number ] ) ? $_widget_titles[ $usage_result->option_name ][ $number ] : []; $name = isset( $_widget['name'] ) ? $_widget['name'] : ''; if ( ! empty( $value['title'] ) ) { $name .= ': ' . $value['title']; } $sidebar_name = isset( $_widget['sidebar_name'] ) ? $_widget['sidebar_name'] . ' > ' : ''; // NOTE: The widget is in the config because it is not deleted, you can find it on // the widgets page in the "Inactive Sidebar (not used)" action, but we do not display this. if ( empty( $sidebar_name ) ) { continue; } $results[ $id ] .= '
' . esc_html( $sidebar_name ); $results[ $id ] .= '' . esc_html( $name ) . ''; $results[ $id ] .= '
'; unset( $_widget, $name, $sidebar_name ); } } } } $group_posts_types = array(); foreach ( $posts_types as $id => $post_type ) { $group_posts_types[ $post_type ][] = $id; } /** * Layouts for archives or taxonomies * * Note: Despite the fact that here the foreach receipt of data * occurs for one type of post (the current one) */ foreach( array( 'us_header', 'us_content_template', 'us_page_block' ) as $us_post_type ) { if ( ! empty( $group_posts_types[ $us_post_type ] ) ) { // Keys from the archives or taxonomy page $usage_meta_keys = array( // Header 'us_header' => array( 'archive_header_id' => __( 'Archives Layout', 'us' ), 'pages_header_id' => __( 'Pages Layout', 'us' ), ), // Content templates 'us_content_template' => array( 'archive_content_id' => __( 'Archives Layout', 'us' ), 'pages_content_id' => __( 'Pages Layout', 'us' ), ), // Footer 'us_page_block' => array( 'archive_footer_id' => __( 'Archives Layout', 'us' ), 'pages_footer_id' => __( 'Pages Layout', 'us' ), ), ); $query = " SELECT tm.term_id, t.name, tt.taxonomy, tm.meta_key, tm.meta_value FROM {$wpdb->termmeta} AS tm LEFT JOIN {$wpdb->terms} AS t ON tm.term_id = t.term_id LEFT JOIN {$wpdb->term_taxonomy} AS tt ON tm.term_id = tt.term_id WHERE tm.meta_value IN( '" . implode( "','", $group_posts_types[ $us_post_type ] ) . "' ) AND tm.meta_key IN( '" . implode( "','", array_keys( $usage_meta_keys[ $us_post_type ] ) ) . "' ) "; // Iterate queries us_iterate_queries( $query, function ( $items ) use ( &$results, $group_posts_types, $usage_meta_keys, $us_post_type ) { foreach ( $items as $item ) { foreach ( $group_posts_types[ $us_post_type ] as $id ) { if ( in_array( $id, explode( ',', $item->meta_value ) ) AND $tax = get_taxonomy( $item->taxonomy ) ) { $result = '
' . $tax->label . ' > '; $result .= $item->name . ' > '; $result .= us_translate( $usage_meta_keys[ $us_post_type ][ $item->meta_key ] ) . ''; $result .= ' (' . us_translate( 'Edit' ) . ')
'; $results[ $id ] .= $result; } } } } ); } } // Menus (nav_menu_item) for Page Blocks only if ( ! empty( $group_posts_types['us_page_block'] ) ) { $meta_value_like = ''; foreach ( $group_posts_types['us_page_block'] as $id ) { if ( ! empty( $meta_value_like ) ) { $meta_value_like .= ' OR'; } $meta_value_like .= " meta1.meta_value LIKE '%" . $id . "%'"; } $query = " SELECT meta1.meta_value, p.ID as post_id FROM {$wpdb->postmeta} meta1 LEFT JOIN {$wpdb->postmeta} meta2 ON ( meta1.post_id = meta2.post_id AND meta2.meta_key = '_menu_item_object' AND meta2.meta_value = 'us_page_block' ) LEFT JOIN {$wpdb->posts} AS p ON meta1.post_id = p.ID WHERE meta1.meta_key = '_menu_item_object_id' AND ({$meta_value_like}) "; // Iterate queries us_iterate_queries( $query, function ( $items ) use ( &$used_in, $ids ) { foreach ( $items as $item ) { if ( ! $post_id = $item->post_id ) { continue; } $meta_value_ids = explode( ',', $item->meta_value ); foreach ( $ids as $id ) { if ( ! in_array( $id, $meta_value_ids ) ) { continue; } $used_in[ $id ]['nav_menu_item'][ $post_id ] = wp_get_post_terms( $post_id, 'nav_menu', array( 'fields' => 'all' ) ); } } } ); } // Append locations to result string foreach ( $ids as $id ) { if ( ! empty( $used_in[ $id ] ) AND ! empty( $used_in[ $id ]['nav_menu_item'] ) ) { foreach ( $used_in[ $id ]['nav_menu_item'] as $location ) { if ( ! empty( $location ) ) { $link_atts = array( 'href' => admin_url( 'nav-menus.php?action=edit&menu=' . $location[0]->term_id ), 'rel' => 'noopener', 'target' => '_blank', 'title' => us_translate( 'Edit Menu' ), ); $results[ $id ] .= '
' . us_translate( 'Menus' ) . ' > ' . $location[0]->name . '
'; } } } } // Return "No results" message if set foreach ( $results as &$result ) { if ( empty( $result ) AND $show_no_results ) { $result = us_translate( 'No results found.' ); } } } return $results; } /** * Generate locations names where used specific element * * @param int $post_ID * @param bool $show_no_results * @return string */ function us_get_used_in_locations( $post_ID, $show_no_results = FALSE ) { $results = (array) us_get_all_used_in_locations( array( $post_ID ), $show_no_results ); return ! empty( $results[ $post_ID ] ) ? $results[ $post_ID ] : ''; } } سئو - سرویس ایران -
[vc_row height="small" width="full" us_bg_image_source="media" us_bg_image="230200" content_placement="middle" parallax_content="parallax_content_value" parallax_content_sense="50" fadeout_row="fadeout_row_value" css="%7B%22default%22%3A%7B%22color%22%3A%22%23ffffff%22%7D%7D"][vc_column width="1/6"][vc_column_text]

[/vc_column_text][/vc_column][vc_column width="3/6"][us_breadcrumbs separator_icon="fas|»" css="%7B%22default%22%3A%7B%22color%22%3A%22%23ffffff%22%7D%7D"][/vc_column][vc_column width="1/6"][us_post_author][/vc_column][vc_column width="1/6"][/vc_column][/vc_row]
[vc_row][vc_column][us_grid post_type="current_query" no_items_message="در این مورد نتیجه ای وجود ندارد" pagination="ajax" items_layout="226405" columns="1" title_size="20px" css="%7B%22default%22%3A%7B%22font-family%22%3A%22h3%22%7D%7D"][/vc_column][/vc_row][vc_row][vc_column][/vc_column][/vc_row]
×

سلام سپاس از حسن انتخاب شما!

برای ارتباط مستیقیم با ما یکی از کارشناسان را جهت پیگیری و پشتیبانی انتخاب نمائید . آیدی مستتقیم تلگرام: @hosseineghlimia 

× گفتگو آنلاین