Created
February 27, 2014 15:07
-
-
Save pedrorvidal/9251863 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_theme_support( | |
'infinite-scroll', | |
array( | |
'type' => 'scroll', | |
'footer_widgets' => false, | |
'container' => 'products', | |
'wrapper' => false, | |
'render' => false, | |
'posts_per_page' => get_option( 'posts_per_page' ) | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. | |
* For example, it puts together the home page when no home.php file exists. | |
* | |
* @link http://codex.wordpress.org/Template_Hierarchy | |
* | |
* @package Odin | |
* @since 2.2.0 | |
*/ | |
get_header(); ?> | |
<div id="home" class="content"> | |
<nav id="color-nav"> | |
<ul> | |
<li class="blue"></li> | |
<li class="purple"></li> | |
<li class="green"></li> | |
<li class="orange"></li> | |
</ul> | |
<div>Oriente-se pelas cores do corredor</div> | |
</nav> | |
<section id="products" class="products"> | |
<ul> | |
<?php | |
$args = array( | |
'post_type' => 'oferta', | |
'posts_per_page' => 12, | |
'order' => 'DESC' | |
); | |
$q = new WP_Query($args); | |
global $post; | |
while ($q->have_posts()) : $q->the_post(); ?> | |
<li> | |
<div class="img"> | |
<?php | |
$imgsrc = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); | |
?> | |
<img src="<?php echo $imgsrc; ?>"> | |
</div> | |
<div class="description"> | |
<header><?php the_title(); ?></header> | |
<div><?php the_content(); ?></div> | |
<?php $metas = get_post_meta( $post->ID ); ?> | |
<div>Est.: <?php echo $metas['estoque'][0]; ?> unidades</div> | |
<div class="de"> | |
<?php | |
$de = $metas['de'][0]; | |
if (!strpos($de, 'de')) { | |
$nde = "de R$ ".$de; | |
} else { | |
$nde = "R$ ".$de; | |
} | |
echo $nde; | |
?> | |
</div> | |
<?php | |
$por = $metas['por'][0]; //199,99 | |
$s = explode(',',$por); //$s[0] = 199, $[1] = ',99'; | |
if (!strpos($s[0], 'por')) { | |
$por = "por R$ "; | |
} else { | |
$por = " R$ "; | |
} | |
?> | |
<div><?php echo $por; ?></div> | |
<div class="por"> | |
<?php echo $s[0]; ?><sup><?php echo ','.$s[1]; ?></sup><sub>cada</sub> | |
</div> | |
</div> | |
</li> | |
<?php endwhile; wp_reset_query(); ?> | |
</ul> | |
</section> | |
</div><!-- #primary --> | |
<?php | |
get_footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment