I'm working on this theme in Wordpress and attempting to edit the plugin so that in when added in Visual Composer it will ask the question how many posts would you like to display? I added this to the Attributes 'number_of_post' => '4', and added this 'posts_per_page' => $number_of_post, to the WP_Query Arguments and it still doesn't seem to be working.
Here is the actual code for the plugin:
//Work Area
function ratio_work_area( $atts , $content = null ){
// Attributes
extract( shortcode_atts(
array(
'sec_title_before' => 'Latest',
'sec_title_after' => 'works',
'sec_btn_text' => 'See More Work',
'sec_btn_link' => '#',
'number_of_post' => '4',
), $atts )
);
ob_start();
?>
<!-- START PORTFOLIO -->
<section id="portfolio" class="works_area section-padding">
<div class="container-fluid">
<div class="row text-center">
<div class="section-title wow zoomIn">
<h2><?php echo esc_html($sec_title_before);?> <span><?php echo esc_html($sec_title_after);?></span></h2>
<div></div>
</div>
<div class="col-md-12">
<div class="our_work_menu">
<?php $terms = get_terms('cat_portfolios');
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
?>
<ul>
<li class="filter wow fadeIn" data-wow-duration="1.5s" data-wow-delay=".25s" data-filter="all"><?php esc_html_e('All' , 'ratio');?></li>
<?php foreach ( $terms as $term ) :?>
<li class="filter" data-filter=".<?php echo esc_attr($term->slug); ?>"><?php echo esc_html($term->name); ?></li>
<?php endforeach;?>
</ul>
<?php }?>
</div>
</div>
<div class="work_all_item">
<?php
// WP_Query arguments
$args = array (
'post_type' => array( 'portfolios' ),
'posts_per_page' => $number_of_post,
);
// The Query
$ratio_port_query = new WP_Query( $args );
// The Loop
if ( $ratio_port_query->have_posts() ) {
while ( $ratio_port_query->have_posts() ) {
$ratio_port_query->the_post();
$ratio_port_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'ratio_image_1200_1200');
?>
<?php
$portfolio_terms = get_the_terms(get_the_id(), 'cat_portfolios');
if ( ! empty( $portfolio_terms ) && ! is_wp_error( $portfolio_terms ) ):
$portfolios_cat_slug = array();
foreach($portfolio_terms as $portfolio_term){
$portfolios_cat_slug[] = $portfolio_term->slug ;
}
$portfolios_cat_array = join(" ", $portfolios_cat_slug);
$portfolios_class_array = join(" ", $portfolios_cat_slug);
endif;
?>
<div class="grid-item col-md-3 col-sm-6 col-xs-12 mix all <?php echo esc_attr($portfolios_class_array);?>">
<div class="single_our_work">
<div class="sing_work_photo">
<figure>
<img src="<?php echo esc_url($ratio_port_image['0']);?>" alt="">
<div class="sing_work_text_link">
<div class="sing_work_content_wrap">
<div class="sing_work_content">
<div class="sing_link_img">
<i class="fa fa-eye"></i>
<i class="fa fa-link"></i>
</div>
<h5><?php the_title();?></h5>
<?php $terms = get_the_terms(get_the_ID(), 'cat_portfolios');
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
?>
<p><?php echo esc_html($term->name); ?></p>
<?php
}
} ?>
</div>
</div>
</div>
</figure>
</div>
</div>
</div>
<?php }
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();
?>
</div>
</div>
<?php if($sec_btn_link){ ?>
<div class="portfolio_btn text-center">
<?php echo esc_html($sec_btn_text);?>
</div>
<?php } ?>
</div>
</section>
<!-- END PORTFOLIO -->
<?php
return ob_get_clean();
}
add_shortcode ('work_area', 'ratio_work_area' );
Please try to use 'number_of_posts' => '4',; You have missed letter s.
If that doesn't work, try to use posts_per_page instead of number_of_posts. It's depend on version you using.
I'm working on a website. I'm using page.php to control all the pages even though they have different categories. All was ok on my local server (XAMPP), I could view all the pages, but when I uploaded online, the loops returned blank.
I decided to echo an "Hello" if page is true which worked fine. The main loop returns blank. Here is my code sample
<?php
//this parts works
if ( is_page( 10 ) ) {
echo "hello";
}
//This returns blank even when the category id and
if ( is_page( 10 ) ) {
$args = array(
'post_type' =>'page',
'posts_per_page' => 1,
'cat' => 5
);
$new_query = new WP_Query( $args );
while ( $new_query->have_posts() ) : $new_query->the_post();
echo '<div class="col-lg-4 col-sm-6">
<div class="post_box3">
<div class="post_cont boxeq">
<a href="' the_permalink(); '">
<h3>' the_title(); '</h3></a>
</div>
</div>
</div>';
endwhile;
wp_reset_postdata();
}
?>
Either echo something or terminate PHP for a moment
while ( $new_query->have_posts() ) : $new_query->the_post();
echo '<div class="col-lg-4 col-sm-6">
<div class="post_box3">
<div class="post_cont boxeq">
<a href="' . the_permalink() . '">
<h3>' . the_title() . '</h3></a>
</div>
</div>
</div>'
endwhile;
or
while ( $new_query->have_posts() ) : $new_query->the_post(); ?>
<div class="col-lg-4 col-sm-6">
<div class="post_box3">
<div class="post_cont boxeq">
<a href="<?php the_permalink(); ?> .">
<h3><?php the_title(); ?></h3></a>
</div>
</div>
</div>
<?php
endwhile;
If you haven't moved an exact copy of your website on the host there might be possibilities that the ID which in your case is 10 or the cat which in your cast is 5 is changed. Try using slugs instead.
<?php
if ( is_page( 'your-page-slug' ) ) {
echo "hello";
}
//This returns blank even when the category id and
if ( is_page( 'your-page-slug' ) ) {
$args = array(
'post_type' =>'page',
'posts_per_page' => 1,
'category_name' => 'your-category-slug'
);
$new_query = new WP_Query( $args );
while ( $new_query->have_posts() ) : $new_query->the_post();
'<div class="col-lg-4 col-sm-6">
<div class="post_box3">
<div class="post_cont boxeq">
<a href="' the_permalink(); '">
<h3>' the_title(); '</h3></a>
</div>
</div>
</div>'
endwhile;
wp_reset_postdata();
}
?>
I'm building an archive page in WordPress that is pulling content from certain page IDs. Is there a way to create a variable that would go in place of 266 in the code below so I don't have to recreate this code for each ID?
<div class="col-md-4">
<div class="ih-item square effect6 from_top_and_bottom">
<a href="<?php echo get_the_permalink( 266 ); ?>">
<div class="img">
<img src="<?php the_field('photo', 266); ?>" />
</div>
<div class="info">
<h4><?php echo get_the_title( 266 ); ?></h4>
</div>
</a>
</div>
</div>
Wrap you code in a function and place that function to functions.php
and just call that function instead of recreating code again.
E.g.
functions.php
<?php
function your_function_name( $page_id ) {
if ( ! $page_id ) {
return;
}
$content = '<div class="col-md-4">
<div class="ih-item square effect6 from_top_and_bottom">
<a href="' . get_the_permalink( $page_id ) . '">
<div class="img">
<img src="' . the_field('photo', $page_id) . '" />
</div>
<div class="info">
<h4>' . get_the_title( $page_id ) . '</h4>
</div>
</a>
</div>
</div>';
return $content
}
?>
archive.php
<?php echo your_function_name( 266 ); ?>
The plugin being used is The Events Calendar PRO, and the website is WordPress.
This code below isn't linking each 'Past Event' image to it's relevant event. Instead it links back to the homepage.
The titles of the events do link to the correct place however, but the same code is being used in both places, so I'm stumped.
Any ideas?
<?php foreach( $events as $event ) : ?>
<div class="tribe-mini-calendar-event">
<div class="list-info">
<div class="tribe-events-event-image">
<?php echo tribe_event_featured_image( $event, 'medium' ); ?>
</div>
<h2 class="tribe-events-title"><?php echo $event->post_title; ?></h2>
<div class="tribe-events-duration">
<?php echo date_i18n( get_option('date_format' ), strtotime( $event->EventStartDate ) ); ?>
</div>
</div>
</div>
<?php endforeach; ?>
Thanks in advance.
======================== UPDATE
The HTML Page Generates this for past event
<div class="tribe-events-event-image">
<a href="http://touring.valhallatavern.com/"><img width="212" height="300" src="http://touring.valhallatavern.com/wp-content/uploads/2016/02/fimbulwinterMMXIV-212x300.jpg" class="attachment-medium size-medium wp-post-image" alt="Fimbulwinter MMXIV" srcset="http://touring.valhallatavern.com/wp-content/uploads/2016/02/fimbulwinterMMXIV-212x300.jpg 212w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/fimbulwinterMMXIV-768x1087.jpg 768w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/fimbulwinterMMXIV-724x1024.jpg 724w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/fimbulwinterMMXIV.jpg 851w"
sizes="(max-width: 212px) 100vw, 212px"></a>
</div>
While it generates this for UPCOMING TOURS
<div class="tribe-events-event-image">
<a href="http://touring.valhallatavern.com/event/between-the-buried-and-me-nz-tour-2016/">
<img width="212" height="300" src="http://touring.valhallatavern.com/wp-content/uploads/2016/02/BTBM-212x300.jpg" class="attachment-medium size-medium wp-post-image" alt="BTB&M" srcset="http://touring.valhallatavern.com/wp-content/uploads/2016/02/BTBM-212x300.jpg 212w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/BTBM-768x1086.jpg 768w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/BTBM-724x1024.jpg 724w, http://touring.valhallatavern.com/wp-content/uploads/2016/02/BTBM.jpg 1500w"
sizes="(max-width: 212px) 100vw, 212px"></a>
</div>
So there is a homepage link being thrown in by the image function...
you have to change ::::
From <?php tribe_event_link( $event ); ?> :::: to <?php echo tribe_event_link( $event ); ?>
<?php foreach( $events as $event ) : ?>
<div class="tribe-mini-calendar-event">
<div class="list-info">
<div class="tribe-events-event-image">
<?php echo tribe_event_featured_image( $event, 'medium' ); ?>
</div>
<h2 class="tribe-events-title"><?php echo $event->post_title; ?></h2>
<div class="tribe-events-duration">
<?php echo date_i18n( get_option('date_format' ), strtotime( $event->EventStartDate ) ); ?>
</div>
</div>
</div>
<?php endforeach; ?>
Try This Code 2
<?php foreach( $events as $event ) { ?>
<div class="tribe-mini-calendar-event">
<div class="list-info">
<div class="tribe-events-event-image">
<a href="<?php echo tribe_event_link( $event ); ?>">
<?php echo tribe_event_featured_image( $event, 'medium' ); ?>
</a>
</div>
<h2 class="tribe-events-title">
<a href="<?php echo tribe_event_link( $event ); ?>">
<?php echo $event->post_title; ?>
</a>
</h2>
<div class="tribe-events-duration">
<?php echo date_i18n( get_option('date_format' ), strtotime( $event->EventStartDate ) ); ?>
</div>
</div>
</div>
<?php } ?>
The function tribe_event_featured_image requires a boolean parameter for a link. Because I wasn't giving it a true or false value it then was producing a link to the homepage. It placed that link within my own link thereby cancelling it out. I amended my code as follows:
I replaced
<?php tribe_event_featured_image( $event, 'medium' ); ?>
with
<?php tribe_event_featured_image( $event, $size = medium, $link = false ); ?>
I have a problem in my template (wordpress).
I want to create a portfolio page which contains 3 columns and which can display posts in my portfolio page (without jumping a new page). And I need to repeat these three posts after each third post. I will assign "hidden" class to my duplicate posts and when clicking at the column, class shall set as "block".
I have a code:
<?php get_header(); ?>
<section> <div class="container container-bazar container-gallery"><?php
$array = array();
$count = 0;
$i = 0;
$args = array(
'posts_per_page' => -1,
'post_type' => 'gallery',
);
$gallery = new WP_Query( $args );
if($gallery->have_posts()) :
while($gallery->have_posts()) :
$gallery->the_post(); ?>
<div class="col-1 boxes<?php if( $count%3 == 0 ) { echo '-1'; }; $count++; ?>">
<div class="post" id="post-<?php the_ID(); ?>">
<figure class="indent-bot">
<a href="<?php the_permalink(); ?>" rel="nofollow">
<?php the_post_thumbnail(array(380,220,true)); ?>
</a>
</figure>
<div class="col-1-content">
<strong class="title-3">
<a href="<?php the_permalink(); ?>" rel="nofollow">
<?php the_title(); ?>
</a>
</strong>
<div class="entry">
<a href="<?php the_permalink(); ?>" rel="nofollow">
<?php the_excerpt(); ?>
</a>
</div><!-- .entry -->
</div><!-- .col-1-content-->
</div><!-- .post -->
</div> <!-- .boxes -->
<?php endwhile; ?>
<?php while($gallery->have_posts()) :
$gallery->the_post();?>
<?php $imgaddr1 = get_post_meta($post->ID, 'imgaddr1', true);
$imgaddr2 = get_post_meta($post->ID, 'imgaddr2', true);
$imgssilka1 = get_post_meta($post->ID, 'imgssilka1', true);
$imgssilka2 = get_post_meta($post->ID, 'imgssilka2', true);
$namecolor1 = get_post_meta($post->ID, 'namecolor1', true);
$namecolor2 = get_post_meta($post->ID, 'namecolor2', true);
$numbercolor1 = get_post_meta($post->ID, 'numbercolor1', true);
$numbercolor2 = get_post_meta($post->ID, 'numbercolor2', true); ?>
</div>
<div class="full clearfix">
<div class="inner">
<figure class="indent-bot1">
<a href="<?php the_permalink(); ?>" rel="nofollow">
<?php the_post_thumbnail(array(960,690)); ?>
</a>
</figure>
<div class="row">
<div class="col-md-5">
<div class="inf-1">
<h4>Информация</h4>
</div>
<div class="inf-2">
<h5><?php the_title(); ?></h5>
<div class="desc">
<?php the_excerpt(); ?>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="col-md-7 border-left">
<div class="inf-1">
<h4>Приложенные Цвета</h4>
</div>
<div class="inf-2">
<ul>
<li class="first-child">
<a href="<?php echo $imgssilka1; ?>" class="img-block">
<img src="<?php echo $imgaddr1; ?>">
</a>
<div class="txt">
<strong><?php echo $namecolor1; ?></strong>
<span><?php echo $numbercolor1; ?></span>
</div>
</li>
<li class="last-child">
<a href="<?php echo $imgssilka2; ?>" class="img-block">
<img src="<?php echo $imgaddr2; ?>">
</a>
<div class="txt">
<strong><?php echo $namecolor2; ?></strong>
<span><?php echo $numbercolor2; ?></span>
</div>
</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
</div>
</div><!-- .inner -->
</div>
<div class="container container-bazar container-gallery">
<?php endwhile;
else:
endif; ?>
</div><!-- .container -->
</section>
<?php get_footer(); ?>
but this code displays posts sequentially.
$i = 1;
//added before to ensure it gets opened
echo '<div>';
if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();
// post stuff...
// if multiple of 3 close div and open a new div
if($i % 3 == 0) {echo '</div><div>';}
$i++; endwhile; endif;
//make sure open div is closed
echo '</div>';
This is quite an unusual setup which had me thinking. There is a way without rerunning the loop
HERE IS HOW
You need to run your loop only once. In stead of the default loop, we will pull out our posts array from our query and run our posts through a foreach loop. This is where we will start things
We need to split our content up so we can get two blocks with post data, and this need to be saved into an array which we will use later. To achieve this, build two concatenated strings of data ( one string with the first block of data and the second one with the second block of data ) which will be saved in two separate variables.
Once this is done, we need to add our divs to form blocks of posts containing three posts, each with a unique class. This goes for both sets of string
Now we need to calculate new array keys so we can build a new array of post data sorted so we have a sequence of a block of post data with three posts from string one, then a block of post data with the same three posts from string two etc
Finally, because our array of posts is still mixed and is out of order, we will sort the array so the keys are numerical, then we can use a last foreach loop to output our post data
HERE IS THE CODE
Just a note or two before I post the code
You need to modify the classes etc to suite your needs
The code is not fully tested, but the div blocks and sorting works as expected
I have commented the code to make it easier to follow
Finally, the code
$args = array(
'posts_per_page' => -1,
'post_type' => 'gallery',
);
$gallery = new WP_Query( $args );
// Check if we have posts before we continue
if( $gallery->have_posts() ) {
// Use the array of posts and a foreach loop to build out super array
foreach ( $gallery->posts as $key=>$post ) {
// Setup postdata so we can make use of template tags
setup_postdata( $post );
// Setup/define our first variable which will hold our first set of post data
$output = '';
// Open a new div on the first post and every 3rd one there after to hold three posts
if ( $key%3 == 0 ) {
// We will call this class "first-x" where x represents the block count
$output .= '<div class="first-' . floor( $key / 3 ) . '">';
}
// Concatenate your first loop into a string to our first variable $output
$output .= '<div class="post" id="post-' . $post->ID . '">
<figure class="indent-bot">
<a href="' . get_the_permalink() . '" rel="nofollow">
' . get_the_post_thumbnail( $post->ID, array( 380,220,true ) ) . '
</a>
</figure>
<div class="col-1-content">
<strong class="title-3">
<a href="' . get_the_permalink() . '" rel="nofollow">
' . get_the_title() . '
</a>
</strong>
<div class="entry">
<a href="' . get_the_permalink() . '" rel="nofollow">
' . get_the_excerpt() . '
</a>
</div><!-- .entry -->
</div><!-- .col-1-content-->
</div><!-- .post -->
</div> <!-- .boxes -->';
// Add our closing div after every third post or the last post if there is less than three
if ( $key%3 == 2 || !array_key_exists( ( $key + 1 ), $gallery->posts ) ) {
$output .= '</div>';
}
// Create our new array of post data split in two and use with new array keys
$new_posts_array[floor( $key / 3 ) * 3 + $key] = $output;
// Setup/define our second variable which will hold the second set of post data from our posts
// This is the set that you would like to hide
$output_1 = '';
// Open a new div on the first post and every 3rd one there after to hold three posts
if ( ( $key%3 ) == 0 ) {
// This block of posts will use class "second-x" where x represents the block count
$output_1 .= '<div class="second-' . floor( $key / 3 ) . '">';
}
$imgaddr1 = get_post_meta( $post->ID, 'imgaddr1', true );
$imgaddr2 = get_post_meta( $post->ID, 'imgaddr2', true );
$imgssilka1 = get_post_meta( $post->ID, 'imgssilka1', true );
$imgssilka2 = get_post_meta( $post->ID, 'imgssilka2', true );
$namecolor1 = get_post_meta( $post->ID, 'namecolor1', true );
$namecolor2 = get_post_meta( $post->ID, 'namecolor2', true );
$numbercolor1 = get_post_meta( $post->ID, 'numbercolor1', true );
$numbercolor2 = get_post_meta( $post->ID, 'numbercolor2', true );
// Concatenate your second set of post data into a string to our second variable $output_1
$output_1 .= '<div class="full clearfix">
<div class="inner">
<figure class="indent-bot1">
<a href="' . get_the_permalink() . '" rel="nofollow">
' . get_the_post_thumbnail( $post->ID, array( 960, 690 ) ) . '
</a>
</figure>
<div class="row">
<div class="col-md-5">
<div class="inf-1">
<h4>Информация</h4>
</div>
<div class="inf-2">
<h5>' . get_the_title() . '</h5>
<div class="desc">
' . get_the_excerpt() . '
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="col-md-7 border-left">
<div class="inf-1">
<h4>Приложенные Цвета</h4>
</div>
<div class="inf-2">
<ul>
<li class="first-child">
<a href="' . $imgssilka1 . '" class="img-block">
<img src="' . $imgaddr1 . '">
</a>
<div class="txt">
<strong>' . $namecolor1 . '</strong>
<span>' . $numbercolor1 . '</span>
</div>
</li>
<li class="last-child">
<a href="' . $imgssilka2 . '" class="img-block">
<img src="' . $imgaddr2 . '">
</a>
<div class="txt">
<strong>' . $namecolor2 . '</strong>
<span>' . $numbercolor2 . '</span>
</div>
</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
</div>
</div><!-- .inner -->
</div>';
// Add our closing div after every third post or the last post if there is less than three
if ( $key%3 == 2 || !array_key_exists( ( $key + 1 ), $gallery->posts ) ) {
$output_1 .= '</div>';
}
// Create our new array of post data split in two and use with new array keys
$new_posts_array[( floor( $key / 3 ) + 1 ) * 3 + $key] = $output_1;
}
wp_reset_postdata();
// Sort our new array so that the keys are numerical again
ksort( $new_posts_array );
// Run a foreach loop to output our posts as we need. No need to modify anything here
foreach ( $new_posts_array as $v )
echo $v;
}
As we all know, WordPress is an open source tool and all plugins are available to manage such formatting.
I recommend to go with plugins to manage your requirements. I have used columns plugin for formatted output.
I got the total number of records and made the loop.
Inside the loop, two-cycle.
First loop displays a table. The second cycle displays a list.
<section>
<div class="container container-gallery">
<?php
$offset = 0;
$offset1 = 0;
$i =0;
$count = 0;
$reset =0;
$reset1 = 0;
$args = array(
'posts_per_page' => -1,
'post_type' => 'gallery',
);
$gallery = new WP_Query( $args );
$numberposts = $gallery->post_count;
if ($numberposts){
$id1=0;
$id2=0;
while($count < $numberposts){
// print_r($arr1);
$count++;
//echo "<h2>".$count."</h2>";
$arr1 = array(
'posts_per_page' => 400,
'post_type' => 'gallery',
'offset'=>$offset
);
$arr2 = array(
'posts_per_page' => 400,
'post_type' => 'gallery',
'offset'=>$offset1
);
$loop1 = new WP_Query($arr1);
$loop2 = new WP_Query($arr1);
while($loop1->have_posts()) : $loop1->the_post();
if ($reset<3) :
$reset++;
?>
<?php
$colorfilter1 = get_post_meta($post->ID, 'checkboxwhite', true);
$colorfilter2 = get_post_meta($post->ID, 'checkbox_beige', true);
$colorfilter3 = get_post_meta($post->ID, 'checkbox_brown', true);
$colorfilter4 = get_post_meta($post->ID, 'checkbox_gray', true);
$colorfilter5 = get_post_meta($post->ID, 'checkbox_black', true);
$colorfilter6 = get_post_meta($post->ID, 'checkbox_vvid', true);
if ($colorfilter1 != "") $colorfilter1 ="white ";
if ($colorfilter2 != "") $colorfilter2 ="beige ";
if ($colorfilter3 != "") $colorfilter3 ="brown ";
if ($colorfilter4 != "") $colorfilter4 ="gray ";
if ($colorfilter5 != "") $colorfilter5 ="black ";
if ($colorfilter6 != "") $colorfilter6 ="vivid ";
$class_color = $colorfilter1.$colorfilter2.$colorfilter3.$colorfilter4.$colorfilter5.$colorfilter6;
?>
<div class="col-1 mcol boxes<?php if( $i%3 == 0 ) { echo '-1'; }; $i++; echo ' '.$class_color;?>" id="colbox<?php echo $id1; $id1++;?>" data-id="click" >
<div class="post" id="post-<?php the_ID(); ?>">
<figure class="indent-bot">
<?php the_post_thumbnail(array(380,220,true)); ?>
</figure>
<div class="col-1-content">
<strong class="title-3">
<?php the_title(); ?>
</strong>
<div class="entry">
<?php the_excerpt(); ?>
</div><!-- .entry -->
</div><!-- .col-1-content-->
</div><!-- .post -->
</div><!-- .boxes -->
<?php else : break;?>
<?php endif; ?>
<?php endwhile; ?>
<?php
$reset = 0;
$offset +=3;
?>
<?php wp_reset_postdata(); ?>
<?php
while($loop2->have_posts()) : $loop2->the_post();
if ($reset1<3) :
$reset1++;
?>
<?php
$numbercolor1 = get_post_meta($post->ID, 'numbercolor1',true);
$numbercolor2 = get_post_meta($post->ID, 'numbercolor2', true);
$imgaddr1 = get_post_meta($post->ID, 'imgaddr1', true);
$imgaddr2 = get_post_meta($post->ID, 'imgaddr2', true);
$imgssilka1 = get_post_meta($post->ID, 'imgssilka1', true);
$imgssilka2 = get_post_meta($post->ID, 'imgssilka2', true);
$namecolor1 = get_post_meta($post->ID, 'namecolor1', true);
$namecolor2 = get_post_meta($post->ID, 'namecolor2', true);
?>
</div>
<div class="full clearfix active colbox<?php echo $id2; $id2++;?>" id="">
<div class="inner">
<figure class="indent-bot1">
<a href="<?php the_permalink(); ?>" rel="nofollow">
<?php the_post_thumbnail(array(960,690)); ?>
</a>
</figure>
<div class="row">
<div class="col-md-5">
<div class="inf-1">
<h4>Информация</h4>
</div>
<div class="inf-2">
<h5><?php the_title(); ?></h5>
<div class="desc">
<?php the_excerpt(); ?>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="col-md-7 border-left">
<div class="inf-1">
<h4>Приложенные<</h4>
</div>
<div class="inf-2">
<ul>
<li class="first-child">
<a href="<?php echo $imgssilka1; ?>" class="img-block">
<img src="<?php echo $imgaddr1; ?>">
</a>
<div class="txt">
<strong><?php echo $namecolor1; ?></strong>
<span><?php echo $numbercolor1; ?></span>
</div>
</li>
<li class="last-child">
<a href="<?php echo $imgssilka2; ?>" class="img-block">
<img src="<?php echo $imgaddr2; ?>">
</a>
<div class="txt">
<strong><?php echo $namecolor2; ?></strong>
<span><?php echo $numbercolor2; ?></span>
</div>
</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="c_btn"></div>
</div>
</div>
</div><!-- .inner -->
</div>
<div class="container container-gallery">
<?php else : break;?>
<?php endif; ?>
<?php endwhile; ?>
<?php
$reset1 = 0;
$offset1 +=3;
?>
<?php wp_reset_postdata(); ?>
<?php
} //end if ($count <= $numberposts)
} //end if ($numberposts)
?>
<?php
if ( have_posts() ) while ( have_posts() ) : the_post(); // старт цикла ?>
<article id="post-<?php the_ID(); ?>">
<?php the_content(); ?>
</article>
<?php endwhile; ?>
</div><!-- .container -->
</section>