Skip to content

Instantly share code, notes, and snippets.

View iiiBird's full-sized avatar
💭
Пока ты спишь - твой конкурент совершенствуется

iBird Rose iiiBird

💭
Пока ты спишь - твой конкурент совершенствуется
View GitHub Profile
@iiiBird
iiiBird / sublime_text_3.bat
Created April 7, 2016 06:40
sublime text 3 open with
@echo off
SET st2Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@iiiBird
iiiBird / empty.php
Created March 26, 2015 06:53
Вывод пустых категорий
<?php
function hide_cat_widget($args){
$args ["hide_empty"] = 0;
return $args;
}
add_filter("widget_categories_args","hide_cat_widget");
@iiiBird
iiiBird / short-news-length.php
Last active August 29, 2015 14:16
Длина короткой новости
<?php
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
@iiiBird
iiiBird / css.php
Last active August 29, 2015 14:16
Подключить CSS
<?php
function my_style_method() {
wp_register_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css' );
wp_register_style( 'styles', get_template_directory_uri() . '/css/styles.css' );
wp_enqueue_style( 'bootstrap');
wp_enqueue_style( 'styles' );
}
add_action( 'wp_enqueue_scripts', 'my_style_method' );
@iiiBird
iiiBird / scripts.php
Last active August 29, 2015 14:16
Подключить скрипты
<?php
function my_scripts_method() {
wp_deregister_script('jquery');
wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', false, false, true );
wp_register_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', false, false, true );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'bootstrap');
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
@iiiBird
iiiBird / news.php
Last active August 29, 2015 14:16
Вывод новости
<?php
<div class="news">
<?php while ( have_posts() ) : the_post(); ?>
<div class="news-item is-post is-post-excerpt" <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<ul class="post-info">
<li>Категория: <?php foreach((get_the_category()) as $category) { echo '<a href="'.get_category_link($category->cat_ID).'" title="'.$category->cat_name.'">'.$category->cat_name.'</a> '; } ?></li>
<li><?php comments_number(); ?></li>
<li><?php echo get_the_date('F j, Y'); ?></li>
</ul>
<div class="post-img">
@iiiBird
iiiBird / index.php
Last active August 29, 2015 14:16
Пример страницы натяжки
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-type" content="text/html; charset=<?php bloginfo('charset'); ?>">
<title><?php wp_title('«', true, 'right'); ?></title>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>> //Нужные классы в боди
@iiiBird
iiiBird / cat-name.php
Last active August 29, 2015 14:16
Вывод названия категории
Категория: <?php foreach((get_the_category()) as $category) { echo '<a href="'.get_category_link($category->cat_ID).'" title="'.$category->cat_name.'">'.$category->cat_name.'</a> '; } ?>
@iiiBird
iiiBird / thumbnail.php
Last active August 29, 2015 14:16
Миниатюры
<?php
//Задать миниатюру в functions.php
if ( function_exists( 'add_theme_support' ) )
add_theme_support( 'post-thumbnails' );
add_image_size( 'lol-thumb', 700, 300, true ); //Жесткий обрезчик миниатюр
<?php the_post_thumbnail('lol-thumb');?> //Вывод
@iiiBird
iiiBird / short-news.php
Last active August 29, 2015 14:16
Замена [...] в короткой новости
<?php
function new_excerpt_more( $more ) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');