• User

    Codice per post random

    Ciao e buon anno a tutti.
    Approfittando del tempo libero permesso dalle feste, ho spostato il mio blog da Wordpress.com al dominio tarantulailblog.it. Ho installato il tema "cover".
    Come potete vedere, nella home c'è un riquadro coi post recenti più letti. Mi interessa poco, anche perché poco più giù c'è l'indice dei post recenti, e i più letti ci sono dentro.
    Mi piacerebbe piuttosto che nel riquadro uscissero 3 post a caso, per recuperare quelli vecchi e dimenticati.
    Non voglio usare i plugin vari che mi danno i post random in homepage, perché non li voglio nell'indice della home, ma in quel preciso riquadro.
    Ho cercato di modificare il codice per far uscire i post a caso anziché quelli "popolari", ma non mi viene fuori niente di buono :bho:
    Vi riporto qui il codice che trovo sulla pagina home.php relativamente a quel box: chi mi saprebbe suggerire come fare la modifica di cui ho bisogno?
    Grazie e auguri ancora!
    Massimo

    <?php
    if ( (get_bloginfo('version') >= 2.9) && (get_option('cover_wp_popular') == 'comments') )
    {
    query_posts("caller_get_posts=1&showposts=3&orderby=comment_count "); $i = 1; ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <?php $words = 17;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <div class="spost">
    <h2><a href="<?php echo the_permalink(); ?>" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <?php
    $words = display_thumbnail(95,80,$words,15);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt); ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '…'; ?> <a href="<?php echo get_permalink($post->ID) ?>"><?php _e('Continua','cover-wp') ?> »</a></p>


  • User Attivo

    Prova con questo codice:

    <?php
    if ( (get_bloginfo('version') >= 2.9) && (get_option('cover_wp_popular') == 'comments') )
    {
    query_posts(array('orderby' => 'rand', 'showposts' => 3)); ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <?php $words = 17;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <div class="spost">
    <h2><a href="<?php echo the_permalink(); ?>" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <?php
    $words = display_thumbnail(95,80,$words,15);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt); ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '?'; ?> <a href="<?php echo get_permalink($post->ID) ?>"><?php _e('Continua','cover-wp') ?> &raquo;</a></p>
    
    

  • User

    Grazie Manetta, fatto. Ma resta uguale... (?)


  • User Attivo

    Prova a togliere:

    if ( (get_bloginfo('version') >= 2.9) && (get_option('cover_wp_popular') == 'comments') )
    {
    

  • User

    Mi dà
    Parse error: syntax error, unexpected '}'

    Se ripristino '{'
    Parse error: syntax error, unexpected T_ELSE
    :gtsad:


  • User Attivo

    Prova a postare l'intero file.


  • User

    Ecco il file home.php (ancora grazie...)

    <?php get_header(); ?>
    <div id="content">
    <div id="center">
    <?php if((!is_paged()) && (get_option('cover_wp_fp_layout', 'magazine') == 'magazine')) { ?>
    <?php $sticky = get_option('sticky_posts'); $args = array('post__in' => $sticky); ?>
    <?php query_posts($args); ?>
    <?php if((have_posts()) && (!empty($sticky))) : ?>
    <div id="sticky">
    <h3><?php _e('Announcements','cover-wp') ?></h3>
    <?php while(have_posts()) : the_post(); ?>
    <?php $words = 75;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <p class="postmeta" style="margin-bottom:2px;"><?php the_time(('F jS, Y','cover-wp')); ?> | <?php comments_popup_link(('Add a Comment','cover-wp'), ('1 Comment','cover-wp'), ('% Comments','cover-wp')); ?></p>
    <div class="the_content">
    <?php
    $words = display_thumbnail(230,165,$words,55);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt); ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '…'; ?> <a href="<?php the_permalink() ?>"><?php _e('Leggi tutto il post','cover-wp') ?> »</a></p>
    </div><!-- /the_content -->
    <?php endwhile; ?>
    </div><!-- /sticky -->
    <?php endif; ?>
    <?php wp_reset_query(); ?>
    <div id="headline">
    <h3><?php _e('Oggi su Tarantula','cover-wp') ?></h3>
    <?php query_posts("caller_get_posts=1&showposts=1"); $i = 1; ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <?php $words = 75;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <p class="postmeta" style="margin-bottom:2px;"><?php the_time(
    ('F jS, Y','cover-wp')); ?> | <?php comments_popup_link(
    ('Add a Comment','cover-wp'), __('1 Comment','cover-wp'), __('% Comments','cover-wp')); ?></p>
    <div class="the_content">
    <?php
    $words = display_thumbnail(230,165,$words,55);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt); ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '…'; ?> <a href="<?php the_permalink() ?>"><?php _e('Leggi tutto il post','cover-wp') ?> »</a></p>
    </div><!-- /the_content -->
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
    <?php else: ?>
    <h2 class="center"><?php _e('No Entries Found','cover-wp') ?></h2>
    <p class="center"><?php _e('There are no entries in this blog.','cover-wp') ?></p>
    <?php endif; ?>
    </div><!-- /headline -->
    <div id="featured">
    <h3><?php _e('Scelti da me','cover-wp') ?></h3>
    <?php query_posts("caller_get_posts=1&showposts=3&category_name=".get_option('cover_wp_featured_cat', 'Featured')); $i = 1; ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <?php $words = 17;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <div class="spost">
    <h2><a href="<?php echo the_permalink(); ?>" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <?php
    $words = display_thumbnail(95,80,$words,15);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt); ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '…'; ?> <a href="<?php echo get_permalink($post->ID) ?>"><?php _e('Continua','cover-wp') ?> »</a></p>
    </div><!-- /spost -->
    <div class="spbottom"></div>
    <?php endwhile; ?>
    <?php else: ?>
    <h2 class="center"><?php _e('No Featured Articles','cover-wp') ?></h2>
    <p class="center"><?php _e('Create a category called "Featured". Articles in that category will be shown here.','cover-wp') ?></p>
    <?php endif; ?>
    </div><!-- /featured -->
    <div id="popular">
    <h3><?php _e('I più letti della settimana','cover-wp') ?></h3>

          <?php
    

    if ( (get_bloginfo('version') >= 2.9) && (get_option('cover_wp_popular') == 'comments') )
    {
    query_posts(array('orderby' => 'rand', 'showposts' => 3)); ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <?php $words = 17;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <div class="spost">
    <h2><a href="<?php echo the_permalink(); ?>" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <?php
    $words = display_thumbnail(95,80,$words,15);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt); ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '…'; ?> <a href="<?php echo get_permalink($post->ID) ?>"><?php _e('Continua','cover-wp') ?> »</a></p>
    </div><!-- /spost -->
    <div class="spbottom"></div>

              <?php endwhile; ?>
    	      <?php else: ?>
                <h2 class="center"><?php _e('No Featured Articles','cover-wp') ?></h2>
                <p class="center"><?php _e('Select a category from the Options Page or create a category called &quot;Featured&quot;. Articles in that category will be shown here.','cover-wp') ?></p>
              <?php endif;
    		} else display_popular(); ?>
        </div><!-- /popular -->
        <div id="latest">
          <h3><?php _e('Articoli recenti','cover-wp') ?></h3>
    	  <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	    $ppp = get_option('posts_per_page');
    		$ppp = $ppp - 1;
            query_posts("caller_get_posts=1&paged=$page&showposts=$ppp&offset=1"); ?>
          <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    	    <?php $words = 60;
              $content = get_the_excerpt();
              $excerpt = explode(' ',$content); ?>
            <div class="spost">
              <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
              <?php
                $words = display_thumbnail(150,105,$words,55);
    			if(count($excerpt) > $words) $count = $words;
    			else $count = count($excerpt) ?>
              <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '&#8230;'; ?> <a href="<?php the_permalink() ?>"><?php _e('Leggi tutto il post','cover-wp') ?> &raquo;</a></p>
            </div><!-- /spost -->
            <div class="spbottom"></div>
            <?php endwhile; ?>
    		<?php wp_reset_query(); ?>
            <div class="navigation">
    	    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } 
              else { ?>
                <div class="left"><?php previous_posts_link(__('&laquo; Articoli più recenti','cover-wp')) ?></div>
                <div class="right"><?php next_posts_link(__('Articoli precedenti &raquo;','cover-wp') ) ?></div>
              <?php } ?>
            </div>
          <?php else: ?>
            <h2 class="center"><?php _e('No Entries Found','cover-wp') ?></h2>
            <p class="center"><?php _e('There are no entries in this blog.','cover-wp') ?></p>
          <?php endif; ?>
        </div><!-- /latest -->
        <?php } else { ?>
        <div id="the_loop">
        <p class="address"><a href="<?php echo home_url(); ?>/" title="Home"><?php bloginfo('name'); ?></a> &raquo; <?php _e('Archive','cover-wp') ?></p>
        <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
          <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
            <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
            <p class="postmeta"><?php the_time(__('F jS, Y','cover-wp')); ?> | <?php comments_popup_link(__('Add a Comment','cover-wp'), __('1 Comment','cover-wp'), __('% Comments','cover-wp')); ?></p>
            <div class="the_content">
              <?php $words = 75;
                $content = get_the_excerpt();
                $excerpt = explode(' ',$content); ?>
              <?php
                $words = display_thumbnail(230,165,$words,55);
    			if(count($excerpt) > $words) $count = $words;
    			else $count = count($excerpt) ?>
              <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '&#8230;'; ?> <a href="<?php the_permalink() ?>"><?php _e('Leggi tutto il post','cover-wp') ?> &raquo;</a></p>
            </div><!-- /the_content -->
            <p class="details"><?php _e('Filed under:','cover-wp') ?> <?php the_category(', '); edit_post_link(__('Edit','cover-wp'), ' &middot; ', ''); ?></p>
          </div><!-- /post -->
        <?php endwhile; ?>
        <div class="navigation">
    	  <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } 
            else { ?>
              <div class="left"><?php previous_posts_link(__('&laquo; Articoli più recenti','cover-wp')) ?></div>
              <div class="right"><?php next_posts_link(__('Articoli precedenti &raquo;','cover-wp')) ?></div>
            <?php } ?>
        </div>
        <?php else: ?>
          <h2 class="center"><?php _e('No Entries Found','cover-wp') ?></h2>
          <p class="center"><?php _e('There are no entries in this blog.','cover-wp') ?></p>
      <?php endif; ?>
        </div><!-- /the_loop -->
        <?php } ?>
      </div><!-- /center -->
    

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>


  • User Attivo

    @maxgiuliani said:

    Mi dà
    Parse error: syntax error, unexpected '}'

    Se ripristino '{'
    Parse error: syntax error, unexpected T_ELSE
    :gtsad:

    Controlla il codice manca una parentesi o una è di troppo!


  • User Attivo

    Prova così:

    <?php get_header(); ?>
    <div id="content">
    <div id="center">
    <?php if((!is_paged()) && (get_option('cover_wp_fp_layout', 'magazine') == 'magazine')) { ?>
    <?php $sticky = get_option('sticky_posts'); $args = array('post__in' => $sticky); ?>
    <?php query_posts($args); ?>
    <?php if((have_posts()) && (!empty($sticky))) : ?>
    <div id="sticky">
    <h3><?php _e('Announcements','cover-wp') ?></h3>
    <?php while(have_posts()) : the_post(); ?>
    <?php $words = 75;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <p class="postmeta" style="margin-bottom:2px;"><?php the_time(__('F jS, Y','cover-wp')); ?> | <?php comments_popup_link(__('Add a Comment','cover-wp'), __('1 Comment','cover-wp'), __('% Comments','cover-wp')); ?></p>
    <div class="the_content">
    <?php
    $words = display_thumbnail(230,165,$words,55);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt); ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '?'; ?> <a href="<?php the_permalink() ?>"><?php _e('Leggi tutto il post','cover-wp') ?> &raquo;</a></p>
    </div><!-- /the_content -->
    <?php endwhile; ?>
    </div><!-- /sticky -->
    <?php endif; ?>
    <?php wp_reset_query(); ?>
    <div id="headline">
    <h3><?php _e('Oggi su Tarantula','cover-wp') ?></h3>
    <?php query_posts("caller_get_posts=1&showposts=1"); $i = 1; ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <?php $words = 75;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <p class="postmeta" style="margin-bottom:2px;"><?php the_time(__('F jS, Y','cover-wp')); ?> | <?php comments_popup_link(__('Add a Comment','cover-wp'), __('1 Comment','cover-wp'), __('% Comments','cover-wp')); ?></p>
    <div class="the_content">
    <?php
    $words = display_thumbnail(230,165,$words,55);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt); ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '?'; ?> <a href="<?php the_permalink() ?>"><?php _e('Leggi tutto il post','cover-wp') ?> &raquo;</a></p>
    </div><!-- /the_content -->
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
    <?php else: ?>
    <h2 class="center"><?php _e('No Entries Found','cover-wp') ?></h2>
    <p class="center"><?php _e('There are no entries in this blog.','cover-wp') ?></p>
    <?php endif; ?>
    </div><!-- /headline -->
    <div id="featured">
    <h3><?php _e('Scelti da me','cover-wp') ?></h3>
    <?php query_posts("caller_get_posts=1&showposts=3&catego ry_name=".get_option('cover_wp_featured_cat', 'Featured')); $i = 1; ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <?php $words = 17;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <div class="spost">
    <h2><a href="<?php echo the_permalink(); ?>" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <?php 
    $words = display_thumbnail(95,80,$words,15);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt); ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '?'; ?> <a href="<?php echo get_permalink($post->ID) ?>"><?php _e('Continua','cover-wp') ?> &raquo;</a></p>
    </div><!-- /spost -->
    <div class="spbottom"></div>
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
    <?php else: ?>
    <h2 class="center"><?php _e('No Featured Articles','cover-wp') ?></h2>
    <p class="center"><?php _e('Create a category called &quot;Featured&quot;. Articles in that category will be shown here.','cover-wp') ?></p>
    <?php endif; ?>
    </div><!-- /featured -->
    <div id="popular">
    <h3><?php _e('I più letti della settimana','cover-wp') ?></h3>
    
    
    <?php query_posts(array('orderby' => 'rand', 'showposts' => 3)); ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <?php $words = 17;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <div class="spost">
    <h2><a href="<?php echo the_permalink(); ?>" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <?php
    $words = display_thumbnail(95,80,$words,15);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt); ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '?'; ?> <a href="<?php echo get_permalink($post->ID) ?>"><?php _e('Continua','cover-wp') ?> &raquo;</a></p>
    </div><!-- /spost -->
    <div class="spbottom"></div>
    
    
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
    <?php else: ?>
    <h2 class="center"><?php _e('No Featured Articles','cover-wp') ?></h2>
    <p class="center"><?php _e('Select a category from the Options Page or create a category called &quot;Featured&quot;. Articles in that category will be shown here.','cover-wp') ?></p>
    <?php endif; ?>
    </div><!-- /popular -->
    <div id="latest">
    <h3><?php _e('Articoli recenti','cover-wp') ?></h3>
    <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $ppp = get_option('posts_per_page');
    $ppp = $ppp - 1;
    query_posts("caller_get_posts=1&paged=$page&showpo sts=$ppp&offset=1"); ?>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <?php $words = 60;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <div class="spost">
    <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <?php
    $words = display_thumbnail(150,105,$words,55);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt) ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '?'; ?> <a href="<?php the_permalink() ?>"><?php _e('Leggi tutto il post','cover-wp') ?> &raquo;</a></p>
    </div><!-- /spost -->
    <div class="spbottom"></div>
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
    <div class="navigation">
    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } 
    else { ?>
    <div class="left"><?php previous_posts_link(__('&laquo; Articoli più recenti','cover-wp')) ?></div>
    <div class="right"><?php next_posts_link(__('Articoli precedenti &raquo;','cover-wp') ) ?></div>
    <?php } ?>
    </div>
    <?php else: ?>
    <h2 class="center"><?php _e('No Entries Found','cover-wp') ?></h2>
    <p class="center"><?php _e('There are no entries in this blog.','cover-wp') ?></p>
    <?php endif; ?>
    </div><!-- /latest -->
    
    <div id="the_loop">
    <p class="address"><a href="<?php echo home_url(); ?>/" title="Home"><?php bloginfo('name'); ?></a> &raquo; <?php _e('Archive','cover-wp') ?></p>
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <p class="postmeta"><?php the_time(__('F jS, Y','cover-wp')); ?> | <?php comments_popup_link(__('Add a Comment','cover-wp'), __('1 Comment','cover-wp'), __('% Comments','cover-wp')); ?></p>
    <div class="the_content">
    <?php $words = 75;
    $content = get_the_excerpt();
    $excerpt = explode(' ',$content); ?>
    <?php
    $words = display_thumbnail(230,165,$words,55);
    if(count($excerpt) > $words) $count = $words;
    else $count = count($excerpt) ?>
    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '?'; ?> <a href="<?php the_permalink() ?>"><?php _e('Leggi tutto il post','cover-wp') ?> &raquo;</a></p>
    </div><!-- /the_content -->
    <p class="details"><?php _e('Filed under:','cover-wp') ?> <?php the_category(', '); edit_post_link(__('Edit','cover-wp'), ' &middot; ', ''); ?></p>
    </div><!-- /post -->
    <?php endwhile; ?>
    <div class="navigation">
    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } 
    else { ?>
    <div class="left"><?php previous_posts_link(__('&laquo; Articoli più recenti','cover-wp')) ?></div>
    <div class="right"><?php next_posts_link(__('Articoli precedenti &raquo;','cover-wp')) ?></div>
    <?php } ?>
    </div>
    <?php else: ?>
    <h2 class="center"><?php _e('No Entries Found','cover-wp') ?></h2>
    <p class="center"><?php _e('There are no entries in this blog.','cover-wp') ?></p>
    <?php endif; ?>
    </div><!-- /the_loop -->
    </div><!-- /center -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    

  • User

    Ne conto 13 aperte e 13 chiuse...
    D'altra parte se tolgo quella '{' che dice Manetta, Wordpress mi dice

    unexpected '}'


  • User

    Ah, Manetta, vedo ora la tua risposta... provo.


  • User

    macché...
    syntax error, unexpected $end


  • User Attivo

    Mi posti il link al tema originale che gli do un occhiata.


  • User

  • User

    Ma dal momento che

    query_posts(array('orderby' => 'rand', 'showposts' => 3)); ?>

    non dà nessun risultato, qual è la parte di codice che dice che lì dentro escono i post "popular", o "random", o altro?


  • User Attivo

    Ho provato in locale e con questo codice funziona:

    <?php get_header(); ?>
        <div id="content">
          <div id="center">
    	    <?php if((!is_paged()) && (get_option('cover_wp_fp_layout', 'magazine') == 'magazine')) { ?>
            <?php $sticky = get_option('sticky_posts'); $args = array('post__in' => $sticky); ?>
            <?php query_posts($args); ?>
            <?php if((have_posts()) && (!empty($sticky))) : ?>
            <div id="sticky">
              <h3><?php _e('Announcements','cover-wp') ?></h3>
            <?php while(have_posts()) : the_post(); ?>
            <?php $words = 75;
                  $content = get_the_excerpt();
    	          $excerpt = explode(' ',$content); ?>
                <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                <p class="postmeta" style="margin-bottom:2px;"><?php the_time(__('F jS, Y','cover-wp')); ?> | <?php comments_popup_link(__('Add a Comment','cover-wp'), __('1 Comment','cover-wp'), __('% Comments','cover-wp')); ?></p>
                <div class="the_content">
                  <?php
    				$words = display_thumbnail(230,165,$words,55);
    			    if(count($excerpt) > $words) $count = $words;
    				else $count = count($excerpt); ?>
                  <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '&#8230;'; ?> <a href="<?php the_permalink() ?>"><?php _e('Read entire article','cover-wp') ?> &raquo;</a></p>
                </div><!-- /the_content -->
            <?php endwhile; ?>
            </div><!-- /sticky -->
            <?php endif; ?>
            <?php wp_reset_query(); ?>
            <div id="headline">
              <h3><?php _e('Headline','cover-wp') ?></h3>
              <?php query_posts("caller_get_posts=1&showposts=1"); $i = 1; ?>
              <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
                <?php $words = 75;
                  $content = get_the_excerpt();
    	          $excerpt = explode(' ',$content); ?>
                <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                <p class="postmeta" style="margin-bottom:2px;"><?php the_time(__('F jS, Y','cover-wp')); ?> | <?php comments_popup_link(__('Add a Comment','cover-wp'), __('1 Comment','cover-wp'), __('% Comments','cover-wp')); ?></p>
                <div class="the_content">
                  <?php
    				$words = display_thumbnail(230,165,$words,55);
    			    if(count($excerpt) > $words) $count = $words;
    				else $count = count($excerpt); ?>
                  <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '&#8230;'; ?> <a href="<?php the_permalink() ?>"><?php _e('Read entire article','cover-wp') ?> &raquo;</a></p>
                </div><!-- /the_content -->
              <?php endwhile; ?>
                <?php wp_reset_query(); ?>
              <?php else: ?>
                <h2 class="center"><?php _e('No Entries Found','cover-wp') ?></h2>
                <p class="center"><?php _e('There are no entries in this blog.','cover-wp') ?></p>
              <?php endif; ?>
            </div><!-- /headline -->
            <div id="featured">
              <h3><?php _e('Featured','cover-wp') ?></h3>
              <?php query_posts("caller_get_posts=1&showposts=3&category_name=".get_option('cover_wp_featured_cat', 'Featured')); $i = 1; ?>
              <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
                <?php $words = 17;
                  $content = get_the_excerpt();
    	          $excerpt = explode(' ',$content); ?>
    			  <div class="spost">
                    <h2><a href="<?php echo the_permalink(); ?>" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                  <?php 
    			    $words = display_thumbnail(95,80,$words,15);
    				if(count($excerpt) > $words) $count = $words;
    				else $count = count($excerpt); ?>
                    <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '&#8230;'; ?> <a href="<?php echo get_permalink($post->ID) ?>"><?php _e('Read more','cover-wp') ?> &raquo;</a></p>
                  </div><!-- /spost -->
                  <div class="spbottom"></div>
              <?php endwhile; ?>
    		  <?php else: ?>
                <h2 class="center"><?php _e('No Featured Articles','cover-wp') ?></h2>
                <p class="center"><?php _e('Create a category called &quot;Featured&quot;. Articles in that category will be shown here.','cover-wp') ?></p>
              <?php endif; ?>
            </div><!-- /featured -->
            <div id="popular">
              <h3><?php _e('Popular','cover-wp') ?></h3>
              <?php
    			  query_posts(array('orderby' => 'rand', 'showposts' => 3)); ?>
    
                  <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
                    <?php $words = 17;
                    $content = get_the_excerpt();
    	            $excerpt = explode(' ',$content); ?>
    			    <div class="spost">
                      <h2><a href="<?php echo the_permalink(); ?>" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                      <?php
                        $words = display_thumbnail(95,80,$words,15);
    					if(count($excerpt) > $words) $count = $words;
    					else $count = count($excerpt); ?>
                  <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '&#8230;'; ?> <a href="<?php echo get_permalink($post->ID) ?>"><?php _e('Read more','cover-wp') ?> &raquo;</a></p>
                    </div><!-- /spost -->
                  <div class="spbottom"></div>
                  <?php endwhile; ?>
    		      <?php else: ?>
                    <h2 class="center"><?php _e('No Featured Articles','cover-wp') ?></h2>
                    <p class="center"><?php _e('Select a category from the Options Page or create a category called &quot;Featured&quot;. Articles in that category will be shown here.','cover-wp') ?></p>
                  <?php endif; ?>
            </div><!-- /popular -->
            <div id="latest">
              <h3><?php _e('Latest','cover-wp') ?></h3>
    		  <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		    $ppp = get_option('posts_per_page');
    			$ppp = $ppp - 1;
                query_posts("caller_get_posts=1&paged=$page&showposts=$ppp&offset=1"); ?>
              <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    		    <?php $words = 60;
                  $content = get_the_excerpt();
    	          $excerpt = explode(' ',$content); ?>
                <div class="spost">
                  <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                  <?php
                    $words = display_thumbnail(150,105,$words,55);
    				if(count($excerpt) > $words) $count = $words;
    				else $count = count($excerpt) ?>
                  <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '&#8230;'; ?> <a href="<?php the_permalink() ?>"><?php _e('Read entire article','cover-wp') ?> &raquo;</a></p>
                </div><!-- /spost -->
                <div class="spbottom"></div>
                <?php endwhile; ?>
    			<?php wp_reset_query(); ?>
                <div class="navigation">
    		    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } 
                  else { ?>
                    <div class="left"><?php previous_posts_link(__('&laquo; Previous Page','cover-wp')) ?></div>
                    <div class="right"><?php next_posts_link(__('Next Page &raquo;','cover-wp') ) ?></div>
                  <?php } ?>
                </div>
              <?php else: ?>
                <h2 class="center"><?php _e('No Entries Found','cover-wp') ?></h2>
                <p class="center"><?php _e('There are no entries in this blog.','cover-wp') ?></p>
              <?php endif; ?>
            </div><!-- /latest -->
            <?php } else { ?>
            <div id="the_loop">
            <p class="address"><a href="<?php echo home_url(); ?>/" title="Home"><?php bloginfo('name'); ?></a> &raquo; <?php _e('Archive','cover-wp') ?></p>
            <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
              <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
                <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php _e('Permanent Link to','cover-wp') ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                <p class="postmeta"><?php the_time(__('F jS, Y','cover-wp')); ?> | <?php comments_popup_link(__('Add a Comment','cover-wp'), __('1 Comment','cover-wp'), __('% Comments','cover-wp')); ?></p>
                <div class="the_content">
                  <?php $words = 75;
                    $content = get_the_excerpt();
    	            $excerpt = explode(' ',$content); ?>
                  <?php
                    $words = display_thumbnail(230,165,$words,55);
    				if(count($excerpt) > $words) $count = $words;
    				else $count = count($excerpt) ?>
                  <p><?php for($i = 0; $i <= $count - 1; $i++) { echo $excerpt*; echo ' '; } echo '&#8230;'; ?> <a href="<?php the_permalink() ?>"><?php _e('Read entire article','cover-wp') ?> &raquo;</a></p>
                </div><!-- /the_content -->
                <p class="details"><?php _e('Filed under:','cover-wp') ?> <?php the_category(', '); edit_post_link(__('Edit','cover-wp'), ' &middot; ', ''); ?></p>
              </div><!-- /post -->
            <?php endwhile; ?>
            <div class="navigation">
    		  <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } 
                else { ?>
                  <div class="left"><?php previous_posts_link(__('&laquo; Previous Page','cover-wp')) ?></div>
                  <div class="right"><?php next_posts_link(__('Next Page &raquo;','cover-wp')) ?></div>
                <?php } ?>
            </div>
            <?php else: ?>
              <h2 class="center"><?php _e('No Entries Found','cover-wp') ?></h2>
              <p class="center"><?php _e('There are no entries in this blog.','cover-wp') ?></p>
          <?php endif; ?>
            </div><!-- /the_loop -->
            <?php } ?>
          </div><!-- /center -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    

  • User

    Splendido, grazie!
    Può essere che a forza di smanettare avevo danneggiato qualcosa nel file... boh?
    Grazie molte,
    Massimo