Viewing File: /home/cienp/public_html/inct-inovamed/wp-content/themes/inovamed/index.php

<?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
 *
 *
 */

get_header(); ?>
<!-- index.php -->
<?php /* Template Name: Posts */ ?>
<?php include 'menu.php'; ?>
<section class="splash splashPesquisadores">
	<div class="wrapper grid">
		<h1 class="title">ARTIGOS E NOTÍCIA DO INOVAMED</h1>
	</div>
</section>

<?php $posts = get_posts(array('post_type' => 'post'));
if(count($posts) >= 3)
{ ?>
<section class="postsDestaque">
	<div class="wrapper owl-carousel">
		<?php 
		$new_query = new WP_Query( array(
		    'posts_per_page' => 5,
		    'post_type'      => 'post',
		    'orderby'        => 'menu_order',
			'status'         => 'published',
			'orderby'		 => 'post_date', 
			'order'          => 'DESC',
 			'meta_query'    => array(
		        'relation'      => 'AND',
		        array(
		            'key'       => 'destaque',
		            'value'     => '1',
		            'compare'   => '=',
		        ),
		    ),
		) );

		while ( $new_query->have_posts() ) : $new_query->the_post();  ?>
		
		 	<a href="<?php echo get_permalink(); ?>">
		 		<div class="texto">
					<h3><?php echo the_title(); ?></h3>
					<span class="lermais animate">Ler mais ></span>
				</div>
				<?php echo get_the_post_thumbnail( $page->ID, 'large' ); ?>
			</a>
		
		<?php endwhile;  
		wp_reset_postdata(); ?>
	</div>
</section>
<?php } ?>
<div class="search_bar wrapper">
    <form action="/" method="get" autocomplete="off">
        <input type="text" name="s" placeholder="Busca" id="keyword" class="input_search" onkeyup="fetch()">
    </form>
</div>

<section class="blog">
	<div class="wrapper" id="ultimosPosts">
		<ul class="posts">
			<?php 
			$new_query = new WP_Query( array(
			    'posts_per_page' => 3,
			    'post_type'      => 'post',
			    'orderby'        => 'menu_order',
				'status'         => 'published',
				'orderby'		 => 'post_date', 
				'order'          => 'DESC',
			    'paged'          => $paged
			) );

			while ( $new_query->have_posts() ) : $new_query->the_post();  ?>
			
			 	<li><a class="grid" href="<?php echo get_permalink(); ?>">
					<h3><?php echo the_title(); ?></h3>
					<div class="data">
						<span class="date animate"><?php the_time('F, Y') ?></span>
						<span class="categoria 
							<?php
								$categories = get_the_category();
								$nome = esc_html( $categories[0]->name );
								$artigo = 'Artigo';
								$noticia = 'Notícia';
								if (strcmp($nome, $artigo) == 0) {
									echo 'artigo';
								}
								if (strcmp($nome, $noticia) == 0) {
									echo 'noticia';
								}
							?>
							">
							<?php
								

								if ( ! empty( $categories ) ) {
									echo esc_html( $categories[0]->name );	
								}
							?>
						</span>
					</div>
					<div class="resumo animate 
					<?php if(get_the_post_thumbnail( $page->ID)){
						echo 'hasThumb';
					} ?>
					">
						<p><?php the_excerpt(); ?></p>
						<span class="lermais animate">Ler mais ></span>
					</div>
					<?php echo get_the_post_thumbnail( $page->ID, 'large' ); ?>
				</a></li>
			
			<?php endwhile;  
			wp_reset_postdata(); ?>
		</ul>
		<?php  $count = wp_count_posts( 'post' )->publish;
		if($count >  3) {
			echo '<span class="carregaPosts carregaBlog botao">Carregar mais</span>';
		} ?>
	</div>
	<div class="search_result wrapper" id="datafetch">
        <ul class="posts">
            <li>Pesquisando...</li>
        </ul>
    </div>
</section>


<?php get_footer(); ?>



Back to Directory File Manager