Created
February 5, 2016 03:02
-
-
Save furenku/fa34fbfd18749152e458 to your computer and use it in GitHub Desktop.
tutorial: maquetando para wp
This file contains hidden or 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 | |
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 | |
} | |
?> |
This file contains hidden or 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 | |
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; | |
?> | |
} |
This file contains hidden or 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
<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