/ Published in: PHP
Expand |
Embed | Plain Text
<!-- el CSS que se tendría que añadir a style.css al final de todo (un ejemplo, se puede hacer con px) --> .columna{ width:30%; float:left; margin-right:3% } .columna h5 a{ color:#D90819 } <!-- el HTML y PHP en index.php, etc--> <div class="columna"> <?php $category_id = get_cat_ID( 'Categoría 1' ); $category_link = get_category_link( $category_id ); ?> <?php $posts = get_posts('category_name=noticias&numberposts=3'); foreach($posts as $post): setup_postdata($post); ?> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <?php the_excerpt(); ?> <?php $posttags = get_the_tags($post->ID); if ($posttags) { foreach($posttags as $tag) { echo '<a href="'; echo '">'; echo '</a>'; } } ?> <?php endforeach; ?> </div> <div class="columna"> <?php $category_id = get_cat_ID( 'Categoría 2' ); $category_link = get_category_link( $category_id ); ?> <?php $posts = get_posts('category_name=cine&numberposts=3'); foreach($posts as $post): setup_postdata($post); ?> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <?php the_excerpt(); ?> <?php $posttags = get_the_tags($post->ID); if ($posttags) { foreach($posttags as $tag) { echo '<a href="'; echo '">'; echo '</a>'; } } ?> <?php endforeach; ?> </div> <div class="columna"> <?php $category_id = get_cat_ID( 'Categoría 3' ); $category_link = get_category_link( $category_id ); ?> <?php $posts = get_posts('category_name=musica&numberposts=3'); foreach($posts as $post): setup_postdata($post); ?> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <?php the_excerpt(); ?> <?php $posttags = get_the_tags($post->ID); if ($posttags) { foreach($posttags as $tag) { echo '<a href="'; echo '">'; echo '</a>'; } } ?> <?php endforeach; ?> </div>
You need to login to post a comment.
