'; $currentAfter = ''; if ( !is_home() && !is_front_page() || is_paged() ) { echo '
'; global $post; $home = get_bloginfo('url'); echo '' . $name . ' ' . $delimiter . ' '; if ( is_category() ) { global $wp_query; $cat_obj = $wp_query->get_queried_object(); $thisCat = $cat_obj->term_id; $thisCat = get_category($thisCat); $parentCat = get_category($thisCat->parent); if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' ')); echo $currentBefore . 'Archive by category ''; single_cat_title(); echo ''' . $currentAfter; } elseif ( is_day() ) { echo '' . get_the_time('Y') . ' ' . $delimiter . ' '; echo '' . get_the_time('F') . ' ' . $delimiter . ' '; echo $currentBefore . get_the_time('d') . $currentAfter; } elseif ( is_month() ) { echo '' . get_the_time('Y') . ' ' . $delimiter . ' '; echo $currentBefore . get_the_time('F') . $currentAfter; } elseif ( is_year() ) { echo $currentBefore . get_the_time('Y') . $currentAfter; } elseif ( is_single() ) { $cat = get_the_category(); $cat = $cat[0]; echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' '); echo $currentBefore; the_title(); echo $currentAfter; } elseif ( is_page() && !$post->post_parent ) { echo $currentBefore; the_title(); echo $currentAfter; } elseif ( is_page() && $post->post_parent ) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '' . get_the_title($page->ID) . ''; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $delimiter . ' '; echo $currentBefore; the_title(); echo $currentAfter; } elseif ( is_search() ) { echo $currentBefore . 'Search results for '' . get_search_query() . ''' . $currentAfter; } elseif ( is_tag() ) { echo $currentBefore . 'Posts tagged ''; single_tag_title(); echo ''' . $currentAfter; } elseif ( is_author() ) { global $author; $userdata = get_userdata($author); echo $currentBefore . 'Articles posted by ' . $userdata->display_name . $currentAfter; } elseif ( is_404() ) { echo $currentBefore . 'Error 404' . $currentAfter; } if ( get_query_var('paged') ) { if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' ('; echo __('Page') . ' ' . get_query_var('paged'); if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')'; } echo '
'; } } function widgets($language_code){ global $wpdb; $result = array(); $map = array( 1 => array('ru' => 22, 'en' => 249, 'he' => 250), 2 => array('ru' => 21, 'en' => 247, 'he' => 248), 3 => array('ru' => 454, 'en' => 455, 'he' => 456), 4 => array('ru' => 14, 'en' => 17, 'he' => 279), 5 => array('ru' => 280, 'en' => 281, 'he' => 282) ); $language_id = $wpdb->get_var('SELECT id FROM wp_icl_languages WHERE code = "'.$language_code.'"', 0); $selected_widgets = $wpdb->get_results( "SELECT mp.* FROM wp_main_posts as mp INNER JOIN wp_posts AS p ON p.ID = mp.post_id AND p.post_status = 'publish' WHERE mp.language_id='".$language_id."' GROUP BY widget ORDER BY created DESC ", ARRAY_A ); if($selected_widgets){ foreach ($selected_widgets as $value) { $result[$value['widget']] = $value['post_id']; } } /* echo '';*/ foreach ($map as $item => $value) { if(!isset($result[$item])){ $result[$item] = $wpdb->get_var('SELECT p.id FROM wp_posts AS p INNER JOIN wp_terms AS t ON t.term_id = '.$value[$language_code].' INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships wpr ON wpr.term_taxonomy_id = tt.term_taxonomy_id AND taxonomy= "category" AND wpr.object_id = p.id INNER JOIN wp_icl_translations AS it ON p.ID = it.element_id AND it.language_code = "'.$language_code.'" WHERE p.post_status = "publish" AND p.post_type = "post" ORDER BY p.post_modified DESC LIMIT 1', 0); } } foreach ($result as $key => $id) { $result[$key] = array(); $result[$key]['post'] = $id ? get_post(icl_object_id($id, 'post', false), ARRAY_A) : NULL; /*$wpdb->get_row('SELECT p.* FROM wp_posts AS p INNER JOIN wp_icl_translations AS it ON p.ID = it.element_id AND it.language_code = "'.$language_code.'" WHERE p.ID = "'.$id.'" ORDER BY p.post_modified DESC LIMIT 1', ARRAY_A);*/ if($key == 1) $result[$key]['thumbnail'] = get_the_post_thumbnail($id, 'medium'); else $result[$key]['thumbnail'] = get_the_post_thumbnail($id); $tmp = get_the_category( $result[$key]['post']['ID'] ); $result[$key]['category'] = $id ? $tmp[0]->cat_name : NULL; $result[$key]['post']['post_content'] = preg_replace('/\[.*\]/', '', $result[$key]['post']['post_content']); } return $result; } /*********************new*******************************************/ function theme_add_custom_box() { global $post_ID; if(!$post_ID){ $post_ID=$_GET['post']; } global $wpdb; if($post_ID){ $widgets = range(1, 5); $widget_languages = $wpdb->get_results( "SELECT * FROM wp_icl_languages WHERE code = '".ICL_LANGUAGE_CODE."'", ARRAY_A );//$wpdb->get_results( "SELECT * FROM wp_icl_languages WHERE active = 1", ARRAY_A ); $widget_selected = $wpdb->get_results( "SELECT * FROM wp_main_posts WHERE post_id = ".$post_ID, ARRAY_A ); if($widget_selected){ foreach ($widget_languages as $key => $widget_lang) { foreach($widget_selected AS $widget_select){ if($widget_select['language_id'] == $widget_lang['id'] ){ $widget_languages[$key]['checked'] = $widget_select['widget']; } } } } } foreach ($widget_languages as $key => $widget_lang) { add_meta_box( 'post_widgets', $widget_lang['english_name'], 'post_widgets_metabox', 'post', 'normal', 'core' ); } } function post_widgets_metabox($post){ $post_ID=$post->ID; global $wpdb; if(!$post_ID){ $post_ID=$_GET['post']; } wp_nonce_field( 'post_widgets_metabox', 'post_widgets_metabox_nonce' ); if($post_ID){ $widgets = range(1, 5); $widget_languages = $wpdb->get_results( "SELECT * FROM wp_icl_languages WHERE code = '".ICL_LANGUAGE_CODE."'", ARRAY_A );//$wpdb->get_results( "SELECT * FROM wp_icl_languages WHERE active = 1", ARRAY_A ); $widget_selected = $wpdb->get_results( "SELECT * FROM wp_main_posts WHERE post_id = ".$post_ID, ARRAY_A ); if($widget_selected){ foreach ($widget_languages as $key => $widget_lang) { foreach($widget_selected AS $widget_select){ if($widget_select['language_id'] == $widget_lang['id'] ){ $widget_languages[$key]['checked'] = $widget_select['widget']; } } } } } foreach ($widget_languages as $key => $widget_lang) { foreach($widgets AS $widget){ echo ''; } echo ''; } } function save_widgets_metabox($post_ID){ if ( ! isset( $_POST['post_widgets_metabox_nonce'] ) ) return $post_ID; $nonce = $_POST['post_widgets_metabox_nonce']; if ( ! wp_verify_nonce( $nonce, 'post_widgets_metabox' ) ) return $post_ID; global $wpdb; if($post_ID){ $widgets = range(1, 5); $widget_languages = $wpdb->get_results( "SELECT * FROM wp_icl_languages WHERE active = 1", ARRAY_A ); //Update if ( $post_ID && $_POST) { foreach ($widget_languages as $key => $widget_lang) { foreach($widgets AS $widget){ if(isset($_POST['widget_'.$widget_lang['id']])){ //Save $wpdb->query("DELETE FROM wp_main_posts WHERE post_id = ".$post_ID." AND language_id = ".$widget_lang['id']); if($_POST['widget_'.$widget_lang['id']]){ $wpdb->query("DELETE FROM wp_main_posts WHERE language_id='".$widget_lang['id']."' AND widget='". $_POST['widget_'.$widget_lang['id']]."' "); $wpdb->insert('wp_main_posts', array( 'post_id' => $post_ID, 'language_id' => $widget_lang['id'], 'widget' => $_POST['widget_'.$widget_lang['id']], 'created' => time() ), array( '%d', '%d', '%d', '%d' ) ); } } } } } } } add_action( 'add_meta_boxes', 'theme_add_custom_box' ); add_action( 'admin_init', 'theme_add_custom_box' ); add_action( 'save_post', 'save_widgets_metabox' ); ?> Art in Process

דוד דקטור. עמאן הלוך וחזור.

בנעורי טיילתי בהרי אילת השחורים ובהיתי בהרים הכחולים שמעבר לערבה.
לחצות את הערבה ולהגיע להרים שם
זה היה בלטי אפשרי.

היו הייתה מלכות מעבר לנהר הירדן.

עמאן – אח תאום של ירושלים.
עיר הגבעות עם אותם האורנים ובתי האבן הירושלמית.

דוד דקטור. יולי 2012

Оставьте ваш комментарий

Поля отмеченные * обязательны для заполнения

:
*

*

Сайт оптимально работает в: Internet Explorer 8.0, Mozilla Firefox 3.6, Google Chrome, Safari 4.0. Если у вас старая версия браузера, вы можете скачать новую на сайте производителя бесплатно.