Skip to content

Instantly share code, notes, and snippets.

@furenku
Created February 5, 2016 03:02
Show Gist options
  • Save furenku/fa34fbfd18749152e458 to your computer and use it in GitHub Desktop.
Save furenku/fa34fbfd18749152e458 to your computer and use it in GitHub Desktop.
tutorial: maquetando para wp
<?php
function show_posts() {
for ($i=0; $i < 3 ; $i++) {
$title = "Título del Post_".$i;
$content = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe dicta ducimus atque quibusdam reprehenderit natus, repudiandae quisquam culpa iste perferendis rerum, asperiores architecto, facilis amet.";
$img = "http://fakeimg.pl/1200x600";
?>
<div class="row post">
<h1><?php $title; ?></h1>
<img src="<?php echo $img;?>" alt="">
<p><?php $content(); ?></p>
</div>
<?php
}
?>
<?php
function show_posts() {
$args = array(
'category_name' => 'huevos'
);
$query = new WP_Query( $args );
if( $query->have_posts() ) :
while( $query->have_posts() ) :
$query->the_post();
$title = get_the_title();
$content = get_the_content();
?>
<h1><?php $title; ?></h1>
<p><?php $content(); ?></p>
<?php
endwhile;
endif;
?>
}
<html>
<body>
<div id="blog">
<?php show_posts(); ?>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment