Posted in

Introducir posts en tu página web

Para mostrar en nuestra página web posts de wordpress:

require("/usr/home/tatata/web/_BLOG/wp-config.php");
$my_query = new WP_Query('showposts=3');
<? while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID;?>
                    <h4><a href="<?=the_permalink();?>" target="_blank"><?=htmlentities(the_title());?></a></h4>
                    <p><?=the_excerpt();?></p>
                    <p class="see-more"><a href="<?=the_permalink();?>" target="_blank" class="rollover">[+]</a></p>
                    <p class="clear"></p>
                    <? endwhile;?>

Si lo hacemos desde Laravel 5 habrá que añadir \ a WP_Query:

$my_query = new \WP_Query('showposts=3');

Deixa un comentari

L'adreça electrònica no es publicarà. Els camps necessaris estan marcats amb *


The reCAPTCHA verification period has expired. Please reload the page.