This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function widgets_init_now() { | |
register_sidebar( array( | |
'name' => 'В шапке', | |
'id' => 'header' | |
) ); | |
register_sidebar( array( | |
'name' => 'Левая колонка', | |
'id' => 'aside_left' | |
) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('show_admin_bar', '__return_false'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Custom content function with words manual limit | |
function content($limit, $postid, $showmorelink = true) { //Normally, the second parameter provided is '$post->ID' | |
$content = explode(' ', get_post_field('post_content', $postid), $limit); | |
if (count($content)>=$limit) { | |
array_pop($content); | |
$content = implode(" ",$content); | |
$content = preg_replace('/\[.+\]/','', $content); | |
$content = apply_filters('the_content', $content); | |
$content = str_replace(']]>', ']]>', $content); | |
$content = strip_tags($content,'<br />'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add excerpts to pages | |
add_action( 'init', 'add_excerpts_to_pages' ); | |
function add_excerpts_to_pages() { | |
add_post_type_support( 'page', 'excerpt' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the_category expanded to support custom taxonomies, with possibility to exclude certain categories/terms | |
function catOut($category,$tax,$showlink) { | |
$text = ''; | |
$text .= '<li>'; | |
if ($showlink) {$text .= '<a href="' . get_term_link($category->term_id,$tax).'" title="'.$category->name.'"'.'>';} | |
$text .= $category->name; | |
if ($showlink) {$text .= '</a>';} | |
$text .= '</li>'; | |
return $text; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'numberposts' => -1, // Using -1 loads all posts | |
'orderby' => 'menu_order', // This ensures images are in the order set in the page media manager | |
'order'=> 'ASC', | |
'post_mime_type' => 'image', // Make sure it doesn't pull other resources, like videos | |
'post_parent' => $post->ID, // Important part - ensures the associated images are loaded | |
'post_status' => null, | |
'post_type' => 'attachment' | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add custom post type (books) | |
function book_custompost_init() { | |
$labels_books = array( | |
'name' => _x('Публикации', 'post type general name'), | |
'singular_name' => _x('Публикация', 'post type singular name'), | |
'add_new' => _x('Добавить', 'book'), | |
'add_new_item' => __('Добавить '), | |
'edit_item' => __('Редактировать публикацию'), | |
'new_item' => __('Новая публикация'), | |
'all_items' => __('Все публикации'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create categories for books | |
function create_booktag_taxonomy() { | |
$labels_booktag = array( | |
'name' => _x( 'Тэги публикаций', 'taxonomy general name' ), | |
'singular_name' => _x( 'Тэг публикаций', 'taxonomy singular name' ), | |
'search_items' => __( 'Искать тэги публикаций' ), | |
'all_items' => __( 'Все тэги публикаций' ), | |
'edit_item' => __( 'Редактировать' ), | |
'update_item' => __( 'Обновить' ), | |
'add_new_item' => __( 'Добавить тэг публикаций' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Create categories for pages | |
function create_pages_taxonomy() { | |
$labels_pages_cat = array( | |
'name' => _x( 'Теги страниц', 'taxonomy general name' ), | |
'singular_name' => _x( 'Тег страницы', 'taxonomy singular name' ), | |
'search_items' => __( 'Искать теги страниц' ), | |
'all_items' => __( 'Все теги страниц' ), | |
// 'parent_item' => __( 'Родительская категория страниц' ), | |
// 'parent_item_colon' => __( 'Родительская категория страниц' ), | |
'edit_item' => __( 'Редактировать' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php wp_nav_menu( array( 'theme_location' => 'secmenu', 'container_class' => 'secmenu', 'container' => 'nav' ) ); ?> |
OlderNewer