Skip to content

Instantly share code, notes, and snippets.

<?php echo get_post_meta($post->ID, 'year', true); ?>
//Аякс отправка форм
//Документация: 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("Спасибо за заявку!");
$('.thumb').each(function (i) {
$(this).click(function () {
alert (i+1); //index starts with 0, so add 1 if you want 1 first
});
});
#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;
function heightDetect() {
$(".main_head").css("height", $(window).height());
};
heightDetect();
$(window).resize(function() {
heightDetect();
});
<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<?php endwhile; endif; wp_reset_query(); ?>
<?php
$tags = get_tags();
if ($tags) {
foreach ($tags as $tag) {
echo '<p>Tag: <a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> </p> ';
}
}
?>
<?php
$tags = wp_get_post_tags($post->ID);
<?php
$idObj = get_category_by_slug('s_about');
$id = $idObj->term_id;
echo get_cat_name($id);
?>
$(".tab_item").not(":first").hide();
$(".wrapper .tab").show().click(function() {
var ind = $(this).index();
$(".wrapper .tab").removeClass("active").eq(ind).addClass("active");
$(".tab_item").hide().eq(ind).fadeIn()
}).eq(0).addClass("active");
<div class="wrapper">
<div class="tabs">
<span class="tab">Вкладка 1</span>
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>