<?php $str = get_the_content();
preg_match_all('/src="([^"]+)"/i', $str, $matches);
$img_urls = $matches[1]; ?>
<?php if($img_urls) { ?>
<ul class="gallery">
<?php foreach ($img_urls as $k => $img_url) { ?>
<li>
<a href="<?php echo $img_url; ?>" rel="prettyPhoto[cat-<?php echo $post->ID; ?>]" title="<?php the_title(); ?>">
<img src="<?php echo $img_url; ?>" alt="" />
</a>
</li>
<?php if($k == 2) {
break;
}
} ?>
</ul>
<?php } ?>
$(function() {
$('.emb').each(function() {
$(this).on('click', function() {
var block = $(this).next('.meta-data'),
pinbox = $(this).parents('.pinbox');
pinbox.toggleClass('pinbox_active');
pinbox.parent().toggleClass('pinbox_parent_active');
if (pinbox.hasClass('pinbox_active')) {
block.slideDown(100);
$(document).on('click', function(event) {
if ($(event.target).closest(pinbox).length)
return;
block.hide(100);
pinbox.removeClass('pinbox_active');
pinbox.parent().removeClass('pinbox_parent_active');
event.stopPropagation();
});
}
});
});
});
* {
margin: 0px;
padding: 0px;
}
.pinbox {
position: absolute;
background-color: #2DC5F2;
width: 321px;
border-radius: 12px;
-webkit-border-radius: 12px;
position: relative;
margin: 14px 0 66px 0;
}
.pinbox_active {
-moz-transition: all 150ms linear;
-o-transition: all 150ms linear;
transition: all 150ms linear;
-webkit-transition: all 150ms linear;
z-index: 10;
box-shadow: 0 0 0.5px rgba(0, 0, 0, 0.8), 70px 50px 85px -8px rgba(57, 70, 78, 0.3);
border-radius: 12px;
-moz-border-radius: 12px;
-webkit-border-radius: 12px;
}
.pinbox_parent_active {
background: #ccc;
}
.pinbox .img {
background-color: #2DC5F2;
width: 321px;
border-radius: 12px;
-webkit-border-radius: 12px;
}
.pinbox .preview .thumb {
height: 120px;
display: block;
overflow: hidden;
position: relative;
}
.pinbox .preview .thumb img {
-webkit-border-radius: 11px 11px 0 0;
border-radius: 11px 11px 0 0;
height: auto;
max-width: 321px;
width: 100%;
}
.emb {
cursor: pointer;
position: absolute;
width: 20%;
height: 65px;
left: 50%;
transform: translateX(-50%);
}
.pinbox .meta-data {
display: none;
position: relative;
font-weight: bold;
height: 75px;
z-index: 1;
}
$(function () {
$('.emb').each(function () {
$(this).on('click', function () {
var block = $(this).next('.meta-data'),
pinbox = $(this).parent('.pinbox');
pinbox.toggleClass('pinbox_active');
if (pinbox.hasClass('pinbox_active')) {
block.slideDown(100);
$(document).on('click', function (event) {
if ($(event.target).closest(pinbox).length)
return;
block.hide();
pinbox.removeClass('pinbox_active');
event.stopPropagation();
});
}
});
});
});
function goclicky(meh)
{
var x = screen.width/2 - 700/2;
var y = screen.height/2 - 450/2;
window.open(meh.href, 'sharegplus','height=485,width=700,left='+x+',top='+y);
}
<a href="http://path/to/url" onclick="goclicky(this); return false;" target="_blank">blah</a>
<div class="boxcontainer">
<?php
$last_month_args = array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'posts_per_page' => 10,
'paged' => $paged,
'date_query' => array( array( 'after' => '1 year ago' )));
$last_month_posts = new WP_Query( $last_month_args );
// создадим пустую переменную
$ym_ = "";
if ( $last_month_posts->have_posts() ) {
while ( $last_month_posts->have_posts() ) {
$last_month_posts->the_post();
// запишем год и месяц
$ym = get_the_date('Ym', $post->ID);
// другой год или месяц
if ( $ym_ != $ym ) {
// выведем месяц и год
echo "<H2>".get_the_date('F Y', $post->ID)."</H2>";
}
// выведем пост из шаблона
get_template_part('pinbox', get_post_format());
// сохраним текущий месяц и год для сравнения со следующей записью
$ym_ = $ym;
}
}else{}
wp_reset_postdata(); ?>
</div>
$(function(){
$(document).on('click','.emb', function(){
var block = $(this).closest('.meta-data');
if(block.is(':hidden')){
block.slideDown();
} else {
block.slideUp();
}
})
})
$(window).on('scroll', function() {
var scrollTop = $(this).scrollTop();
var block = $('.meta-data');
block.slideUp();
if (scrollTop < 545) {
block.slideUp();
}
});