Skip to content

Instantly share code, notes, and snippets.

<?php if ( have_posts() ) : query_posts('cat=9');
while (have_posts()) : the_post(); ?>
<div class="col-xs-12 col-sm-6 col-md-3 gallery-thumb">
<a href="<?php
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
echo $large_image_url[0];
?>" data-toggle="lightbox" data-title="<?php the_content(); ?>">
<div class="wrapper-img-sto"><!--background DIV-->
<?php the_post_thumbnail(); ?>
<?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');
}
?>
@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 echo get_post_meta($post->ID, 'year', true); ?>
@Scordavis
Scordavis / js
Created April 27, 2017 10:31
Wrap first letter of Sentence in tag (span) with class
$(function(){
var a = new String;
a = $('.section-heading').html();
var b = a.indexOf(' ');
if (b == -1) {
b = a.length;
}
$('.section-heading').html('<span>'+a.substring(0, 1)+'</span>'+a.substring(b, 1)+a.substring(b, a.length));
});
@Scordavis
Scordavis / php
Created April 26, 2017 21:05
Widgetizing Themes adding widget from 'function.php'
<?php
/**
* Register our sidebars and widgetized areas.
*
*/
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Home right sidebar',
'id' => 'home_right_1',
function heightDetect() {
$(".main_head").css("height", $(window).height());
};
heightDetect();
$(window).resize(function() {
heightDetect();
});
Keymap (Windows Users):
[
{ "keys": ["ctrl+shift+d"], "command": "find_under_expand" },
{ "keys": ["ctrl+d"], "command": "reindent" },
]
Settings:
{
"show_definitions": false,
"auto_complete": false,
@Scordavis
Scordavis / switcher script
Created April 15, 2017 20:45
Скрипт отслеживания класса
<ul id="myTab">
<li><a href="#">1 минута</a>
<li><a href="#">2 минута</a>
<li><a href="#">3 минута</a>
<li><a href="#">4 минута</a>
<li><a href="#">5 минута</a>
</ul>
/--------------------------------------------------------/