Demo entry 6644543

Index

   

Submitted by Prova on Oct 04, 2017 at 10:06
Language: HTML+PHP. Code size: 2.6 kB.

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package brood
 */

get_header(); ?>

	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">
		<?php query_posts('posts_per_page=12');?>
		<?php if ( have_posts() ) : ?>
			<div class="row">
			<?php $c=1; while ( have_posts() ) : the_post(); ?>
					<?php /* 
								if ($c==1){
								$margin_lr='margin-left: -25px;';
								$c=2;
								}
								else {
								$margin_lr='margin-left: 4px;';
								$c=1;
								}*/?>
					<?php
							//controllo se c'รจ immagine in evidenzia 
							if ( has_post_thumbnail() ) { 
							?>			
								
<div class="col-md-6" style="<?php echo $margin_lr; ?>">
								   <div class="panel panel-default">
									<div class="panel-body">
								  <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"/><?php the_title() ?></a></h3><center><?php the_post_thumbnail(array(150, 550),array('class'=>'media-object img-rounded')); ?></center>
								  <?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>" class="btn btn-primary btn-sm">Continua a leggere</a>
								</div>
								</div>
							</div>				
							<?php }else{ ?>
								<div class="col-md-6" style="<?php echo $margin_lr; ?>">
								   <div class="panel panel-default">
									<div class="panel-body">
								  <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"/><?php the_title() ?></a></h3>
								  <?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>" class="btn btn-primary btn-sm">Continua a leggere</a>
								</div>
								</div>
							</div>
						<?php 					/*
					 * Include the Post-Format-specific template for the content.
					 * If you want to override this in a child theme, then include a file
					 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
					 */
					/*get_template_part( 'template-parts/content', get_post_format() );*/
				} ?>
			
			<?php endwhile; ?>
	
			<?php the_posts_navigation(); ?>

		<?php else : ?>

			<?php //get_template_part( 'template-parts/content', 'none' ); ?>

		<?php endif; ?>

		</main><!-- #main -->
	</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).