Mostrare pagine specifiche nella pagina principale invece delle ultime

13 giu 2012, 00:05:00
Visualizzazioni: 68
Voti: 0

Sulla mia installazione di WordPress vengono visualizzate le 3 pagine più recenti. Ecco il codice.

<div id="main_posts">
<?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('showposts=3'.'&paged='.$paged . '&post_type=page' );
?>
<?php //query_posts('showposts=3'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="main_post">
    <?php $image = get_post_meta($post->ID, 'Image', true); ?>
        <a href="<?php the_permalink(); ?>">
            <img class="post_image" width="251" height="292" src="<?php echo $image; ?>" alt="Miniatura della pagina" title="Miniatura della pagina" />

            <div class="main_post_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
    </div>

Vorrei mostrare 3 pagine specifiche che scelgo io nella pagina principale. Come posso fare?

0
Tutte le risposte alla domanda 1
0

Questo dovrebbe funzionare inserendo i giusti ID. L'attributo paged è inutile qui poiché mostrerai sempre gli stessi articoli.

<div id="main_posts">
<?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query(array(
        'showposts' => 3,
        //'paged' => $paged,
        'post_type' => 'page',
        'post__in' => array(1, 2, 3) // I tuoi ID degli articoli
    ));
?>
<?php //query_posts('showposts=3'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="main_post">
    <?php $image = get_post_meta($post->ID, 'Image', true); ?>
        <a href="<?php the_permalink(); ?>">
            <img class="post_image" width="251" height="292" src="<?php echo $image; ?>" alt="Immagine dell'articolo" title="Immagine dell'articolo: <?php the_title(); ?>" />

            <div class="main_post_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
    </div>
13 giu 2012 01:14:32