Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/03/2015, 14:49
Burlon23
 
Fecha de Ingreso: marzo-2015
Ubicación: Buenos Aires
Mensajes: 32
Antigüedad: 10 años, 1 mes
Puntos: 0
como mostrar solo tres post (PHP)

Hola amigos, les agradeceria su ayuda, estoy usando este codigo php en mi web:

Código PHP:
<?php 

$posts 
get_field('selector_de_noticias');

if( 
$posts ): ?>

    
    <?php foreach( $posts as $p ): ?>
    
        <li>
        
           <a class="titulo_noticia_evento_link" href="<?php echo get_permalink$p->ID ); ?>"><?php echo get_the_title$p->ID ); ?></a>
        <div class="imagen_noticia_evento"> <?php echo get_the_post_thumbnail$p->ID ); ?> </div>
        
        </li>
        
    <?php endforeach; ?>
Y me gustaria saber como mostrar un numero limitado de post, me dan este codigo:

Código PHP:
<?php 

// get only first 3 results
$ids get_field('conference_talks'falsefalse);

$query = new WP_Query(array(
    
'post_type'          => 'conferences',
    
'posts_per_page'    => 3,
    
'post__in'        => $ids,
    
'post_status'        => 'any',
    
'orderby'            => 'rand',
));

?>
Pero nose como insertar esto que me dan en mi codigo, espero me puedan ayudar, muchas gracias de ante mano