Skip to content

Instantly share code, notes, and snippets.

@sibicode
sibicode / script.js
Last active June 8, 2017 05:13
Fix auto scroll when mfp open
$('.gallery').each(function() {
$(this).magnificPopup({
delegate: 'a',
type: 'image',
fixedContentPos: false,
fixedBgPos: false,
callbacks: {
open: function() {
$('body').addClass('noscroll');
},
@sibicode
sibicode / style.css
Created June 6, 2017 05:40
box-sizing
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
<!-- Bootstrap trigger to open modal -->
<a data-toggle="modal" href="#rating-modal">Write a Review</a>
<div class="hide fade modal" id="rating-modal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h2>Your Review</h2>
</div>
<div class="modal-body">
//Аякс отправка форм
//Документация: http://api.jquery.com/jquery.ajax/
$("#form, #form2").submit(function(e) {
e.preventDefault;
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize()
}).done(function() {
alert("Спасибо за заявку!");
@sibicode
sibicode / button.sass
Created April 23, 2017 09:15 — forked from agragregra/button.sass
Button Sass Styles (Universal Starter)
.button
display: inline-block
border: none
color: #fff
text-decoration: none
background-color: $accent
padding: 15px 45px
font-size: 13px
text-transform: uppercase
font-weight: 600
@sibicode
sibicode / 0_reuse_code.js
Created March 31, 2017 11:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sibicode
sibicode / functions.php
Created November 6, 2015 07:56
WP single шаблон для определенной категории
// Шаблон для постов рубрики работы
function wpse_custom_category_single_template( $single_template ) {
global $post;
// get all categories of current post
$categories = get_the_category( $post->ID );
$top_categories = array();
// get top level categories
@sibicode
sibicode / functions.php
Created November 2, 2015 04:47
WP Добавляем настройки темы
// Добавляем настройки темы
add_action('customize_register', function($customizer) {
$customizer->add_section(
'section_one', array(
'title' => 'Настройки сайта',
'description' => '',
'priority' => 11,
)
);
$customizer->add_setting('phone',
@sibicode
sibicode / gist:43d5b00c3cb06b675014
Created October 30, 2015 12:15
WP Вывести содердимое страницы
<?php
// Число 108 замените на идентификатор вашей страницы, которую хотите загрузить:
$page_id = 108;
// Вы должны присвоить идентификатор переменной, иначе WordPress будет генерировать ошибку:
$page_data = get_page( $page_id );
// Показываем заголовок страницы:
print '<h2>'. $page_data->post_title .'</h2>';
// Выводим содержимое страницы, сохраняя стандартные фильтры WordPress:
print apply_filters('the_content', $page_data->post_content);
?>
@sibicode
sibicode / functions.php
Created October 30, 2015 09:04
WP ЧПУ странциы поиска
// Меняем ссылку страницы поиска на site/search/
function fb_change_search_url_rewrite() {
if ( is_search() && ! empty( $_GET['s'] ) ) {
wp_redirect( home_url( "/search/" ) . urlencode( get_query_var( 's' ) ) );
exit();
}
}
add_action( 'template_redirect', 'fb_change_search_url_rewrite' );