Skip to content

Instantly share code, notes, and snippets.

#loader {
background: none repeat scroll 0 0 #ffffff;
bottom: 0;
height: 100%;
left: 0;
position: fixed;
right: 0;
top: 0;
width: 100%;
z-index: 9999;
Keymap (Windows Users):
[
{ "keys": ["ctrl+shift+d"], "command": "find_under_expand" },
{ "keys": ["ctrl+d"], "command": "reindent" },
]
Settings:
{
"show_definitions": false,
"auto_complete": false,
function heightDetect() {
$(".main_head").css("height", $(window).height());
};
heightDetect();
$(window).resize(function() {
heightDetect();
});
<?php echo get_post_meta($post->ID, 'year', true); ?>
@Scordavis
Scordavis / WordPress query_posts
Last active December 13, 2017 07:41 — forked from agragregra/WordPress query_posts
использовать query_posts() может быть опасно https://wp-kama.ru/function/query_posts#vazhno-ispolzovat-query_posts-mozhet-byt-opasno
<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_excerpt(); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; endif; wp_reset_query(); ?>
<?php
$post = $wp_query->post;
if (in_category('cat_label_1')) {
include(TEMPLATEPATH.'/single-cat_label_1.php');
} elseif (in_category('cat_label_2')) {
include(TEMPLATEPATH.'/single-cat_label_2.php');
}
?>
//In Template
<?php
$options = get_option('sample_theme_options');
echo $options['phone1'];
?>
//in functions.php
require_once ( get_stylesheet_directory() . '/theme-options.php' );
<?php
$idObj = get_category_by_slug('s_about');
$id = $idObj->term_id;
echo get_cat_name($id);
?>
или
<?php
$idObj = get_category_by_slug('sto_section');
//Аякс отправка форм
//Документация: 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("Спасибо за заявку!");