diff --git a/functions.php b/functions.php index 80f7a84..82c5cf3 100644 --- a/functions.php +++ b/functions.php @@ -514,6 +514,105 @@ function find_perevod($post_id){ } +# add concurs +/** +add_action( 'init', function () { + + + // Указываем метки UI для произвольного типа записи + + $labels = array( + + 'name' => _x( 'Movies', 'Post Type General Name', 'twentythirteen' ), + + 'singular_name' => _x( 'Movie', 'Post Type Singular Name', 'twentythirteen' ), + + 'menu_name' => __( 'Movies', 'twentythirteen' ), + + 'parent_item_colon' => __( 'Parent Movie', 'twentythirteen' ), + + 'all_items' => __( 'All Movies', 'twentythirteen' ), + + 'view_item' => __( 'View Movie', 'twentythirteen' ), + + 'add_new_item' => __( 'Add New Movie', 'twentythirteen' ), + + 'add_new' => __( 'Add New', 'twentythirteen' ), + + 'edit_item' => __( 'Edit Movie', 'twentythirteen' ), + + 'update_item' => __( 'Update Movie', 'twentythirteen' ), + + 'search_items' => __( 'Search Movie', 'twentythirteen' ), + + 'not_found' => __( 'Not Found', 'twentythirteen' ), + + 'not_found_in_trash' => __( 'Not found in Trash', 'twentythirteen' ), + + ); + + + + // Задаем опции для произвольного типа записи + + + + $args = array( + + 'label' => __( 'Конкурсы'), + + 'description' => __( 'Управление конкурсами' ), + + 'labels' => $labels, + + 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields'), + + 'hierarchical' => false, + + 'public' => true, + + 'show_ui' => true, + + 'show_in_menu' => true, + + 'show_in_nav_menus' => true, + + 'show_in_admin_bar' => true, + + 'menu_position' => 5, + + 'can_export' => true, + + 'has_archive' => true, + + 'exclude_from_search' => false, + + 'publicly_queryable' => true, + + 'capability_type' => 'page', + + + + // Вот здесь мы добавим таксономии в наш ПТЗ + + 'taxonomies' => [], + + ); + + + + // Регистрируем произвольный тип записи + + register_post_type( 'concurs', $args ); + + + + }, 0); + + */ + + + add_action( 'pre_get_posts', function ($query) { if ( ! is_admin() && $query->is_main_query() ) { diff --git a/header.php b/header.php index 66c0b36..1511a70 100644 --- a/header.php +++ b/header.php @@ -4,7 +4,7 @@ <?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?> - + diff --git a/helpers/number_title.php b/helpers/number_title.php index de6b0ee..dd3e67a 100644 --- a/helpers/number_title.php +++ b/helpers/number_title.php @@ -15,6 +15,7 @@ function number_info($title){ if (isset($findpdf ['guid'])){ $res['guid'] = $findpdf['guid']; $res['year'] = $items[4]; + $res['number'] = $number; } return $res; diff --git a/index.php b/index.php index b1d73f7..0713b89 100644 --- a/index.php +++ b/index.php @@ -74,6 +74,13 @@ $nn = 0;?> 'mob-lite']);?> 'mob-lite']);?> +
+ + + + +
+ diff --git a/single-3.php b/single-3.php index a9e375b..845c430 100644 --- a/single-3.php +++ b/single-3.php @@ -44,9 +44,63 @@ get_header();?> - - - + + + + + 'номер'.$curr_number['number'] + ]); + + $pitems = []; + $endpolosa = 1; + + foreach ($posts as $post){ + + $posttags = get_the_tags($post->ID); + + foreach ($posttags as $tag){ + $pfind = strpos($tag->name, 'полоса'); + if ($pfind !== false) { + $number = substr($tag->name, 0, $pfind); + if ($number > $endpolosa ){ + $endpolosa = $number; + } + $pitems[$number][] = $post; + } + } + }?> + + + +

Полоса

+ + ID); + $category_id = $category[0]->term_id; + $category_link = get_category_link($category_id);?> +
+ ID) ) :?> +
+ <?=$item->title;?> + + + +
+ +
ID);?>
+
+ + +
+
+ + + + +