Month top post by views. WordPress code example open

Month top post by views. WordPress code example

<div class="homeinfop3">
			<h2>Popular for the month</h2>
		</div>
		<div class="margin10"></div>
		<?php
		$month = date( 'm' );
		$year  = date( 'Y' );
		query_posts( 'post_type=post&posts_per_page=3&meta_key=post_views_count&orderby=meta_value_num&year=' . $year . '&monthnum=' . $month );

		while ( have_posts() ) :
			the_post(); ?>


			<article id="post-<?php the_ID(); ?>" <?php post_class( 'group post-list2' ); ?>>
				<?php if ( get_field( 'cestesr' ) ) : ?>
					<div class="gamelist2">
					<?php else : ?>
						<div class="gamelist">
						<?php endif; ?>


						<div class="imgwithtext">
							<a href="<?php the_permalink(); ?>"> <img
									src="<?php echo get_the_post_thumbnail_url( $thumb_id, 'thumbnail' ) ?>" class="postimg2"
									alt="<?php the_title(); ?>" title="<?php the_title(); ?>" /></a>
							<?php if ( get_field( 'chas' ) ) : ?><span><i class="fa fa-clock-o" aria-hidden="true"></i>
									<?php the_field( 'chas' ); ?>
								</span>
							<?php endif; ?>
							<?php if ( comments_open() && ( get_theme_mod( 'comment-count', 'on' ) == 'on' ) ) : ?>
								<span2><a href="<?php comments_link(); ?>"><i class="fa fa-comments-o"></i>
										<?php comments_number( '0', '1', '%' ); ?>
									</a></span2>
							<?php endif; ?>
							<?php if ( get_field( 'cevip' ) ) : ?>
								<span3>VIP</span3>
							<?php endif; ?>
						</div>

						<h2 class="h2list">
							<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
						</h2>
						<div class="timenumberlist"><i class="fa fa-list-ol" aria-hidden="true"></i>
							<?php the_field( 'zapit' ); ?>
						</div>
						<div class="sproblist"><i class="fa fa-undo" aria-hidden="true"></i>
							<?php the_field( 'sprop' ); ?>
						</div>
						<div class="skladnistlist"><i class="fa fa-thermometer-full" aria-hidden="true"></i> <span>
								<?php the_field( 'skladnist' ); ?>
							</span></div>
						<br>
						<div class="listpriz">
							<strong><i class="fa fa-gift" aria-hidden="true"></i> Призи:</strong>

							<?php if ( get_field( 'rattung' ) ) : ?> <i class="fa fa-plus" aria-hidden="true"></i>
								<?php the_field( 'rattung' ); ?>
							<?php endif; ?>

							<?php if ( get_field( 'medali' ) ) : ?> <i class="fa fa-trophy" aria-hidden="true"></i>
								<?php the_field( 'medali' ); ?>
							<?php endif; ?>

						</div>

					</div>
			</article><!--/.post-->


			<?php
		endwhile;
		wp_reset_query(); ?>
0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation