Skip to content

Instantly share code, notes, and snippets.

View zexeder's full-sized avatar
:octocat:

Antoȵ zexeder

:octocat:
View GitHub Profile
@zexeder
zexeder / WP_jquery_include.php
Last active November 17, 2015 10:55
Подключение jQuery в WP
<?php
function my_scripts_method() {
wp_enqueue_script(
'custom-script',
get_stylesheet_directory_uri() . '/js/main.js',
array('jquery')
);
}
add_action('wp_enqueue_scripts', 'my_scripts_method');
?>
@zexeder
zexeder / WP_breadcrumb.php
Last active August 29, 2015 14:19
Хлебные крошки
<?php
function the_breadcrumb() {
echo '<div id="breadcrumb"><ul><li><a href="/">Главная</a></li><li>></li>';
if ( is_category() || is_single() ) {
$cats = get_the_category();
$cat = $cats[0];
echo '<li><a href="'.get_category_link($cat->term_id).'">'.$cat->name.'</a></li><li>></li>';
}
@zexeder
zexeder / WP_menu_fixed.js
Created April 14, 2015 09:52
Фиксированное меню WP
//Fixed menu
$(function(){
$(window).scroll(function() {
var top = $(document).scrollTop();
if (top < 100) $("#navigation").css({top: '0', position: 'relative'});
else $("#navigation").css({top: '0', position: 'fixed'});
});
});
@zexeder
zexeder / WP_child_theme.css
Created April 14, 2015 10:07
Дочерняя тема WP
/*
Theme Name: Mosaic Child
Description: Child theme for ...
Author: qurusan
Template: mosaic
Version: 0.1.0
*/
@import url("../mosaic/style.css");
@zexeder
zexeder / WP_add_search_into_menu.php
Created April 26, 2015 20:05
Добавление поиска в меню WP
//Добавить в functions.php
add_filter( 'wp_nav_menu_items', 'add_search_box', 10 , 2);
function add_search_box ( $items, $args ) {
if( 'menu-index' === $args -> theme_location )
$items .= '<li class="custom-func-li-last">' . get_search_form(false) . '</li>';
return $items;
}
//menu-index - это название меню к которому будет добавлен элемент,
@zexeder
zexeder / sticky_footer.css
Last active August 29, 2015 14:20
Липкий футер
@zexeder
zexeder / mobile_friendly.css
Created May 28, 2015 09:12
Адаптивная верстка
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
/*========== Desktop First Method ==========*/
/* Large Devices, Wide Screens */
@media only screen and (max-width : 1200px) {
}
/* Medium Devices, Desktops */
HTML:
<div class="wrapper">
<div class="tabs">
<span class="tab">Вкладка 1</span>
<span class="tab">Вкладка 2</span>
<span class="tab">Вкладка 3</span>
</div>
<div class="tab_content">
<div class="tab_item">Содержимое 1</div>
<div class="tab_item">Содержимое 2</div>
@zexeder
zexeder / WP_remove_allow_tags.php
Last active August 29, 2015 14:23
Уделение доступных тегов в комментах
<?php
// function remove_comment_fields($fields) {
// unset($fields['url']);
// return $fields;
// }
// add_filter('comment_form_default_fields', 'remove_comment_fields');
// function mytheme_init() {
// add_filter('comment_form_defaults','mytheme_comments_form_defaults');
// }
@zexeder
zexeder / set jQuery cookies on 30 minutes
Created July 2, 2015 14:42
set jQuery cookies on 30 minutes
var date = new Date();
var minutes = 30;
date.setTime(date.getTime() + (minutes * 60 * 1000));
$.cookie("example", "foo", { expires: date });