Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. CMS & Piattaforme Self-Hosted
  5. Codice per post random

Codice per post random

Pianificato Fissato Bloccato Spostato CMS & Piattaforme Self-Hosted
17 Post 3 Autori 2.6k Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • M
    M
    maxgiuliani
    scritto su ultima modifica di
    User 0
    #1
    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[$i]; echo ' '; } echo '…'; ?> <a href="<?php echo get_permalink($post->ID) ?>"><?php _e('Continua','cover-wp') ?> »</a></p>

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • M
      M
      manetta
      scritto su ultima modifica di
      User Attivo 5
      #2

      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[$i]; echo ' '; } echo '?'; ?> <a href="<?php echo get_permalink($post->ID) ?>"><?php _e('Continua','cover-wp') ?> &raquo;</a></p>
      
      1 Risposta Ultima Risposta
      Miglior risposta 0
      0
      • M
        M
        maxgiuliani
        scritto su ultima modifica di
        User 0
        #3

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

        1 Risposta Ultima Risposta
        Miglior risposta 0
        0
        • M
          M
          manetta
          scritto su ultima modifica di
          User Attivo 5
          #4

          Prova a togliere:

          if ( (get_bloginfo('version') >= 2.9) && (get_option('cover_wp_popular') == 'comments') )
          {
          
          1 Risposta Ultima Risposta
          Miglior risposta 0
          0
          • M
            M
            maxgiuliani
            scritto su ultima modifica di
            User 0
            #5

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

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

            1 Risposta Ultima Risposta
            Miglior risposta 0
            0
            • M
              M
              manetta
              scritto su ultima modifica di
              User Attivo 5
              #6

              Prova a postare l'intero file.

              1 Risposta Ultima Risposta
              Miglior risposta 0
              0
              • M
                M
                maxgiuliani
                scritto su ultima modifica di
                User 0
                #7

                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[$i]; 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[$i]; 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[$i]; 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[$i]; 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[$i]; 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[$i]; 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(); ?>

                1 Risposta Ultima Risposta
                Miglior risposta 0
                0
                • C
                  C
                  clubbu
                  scritto su ultima modifica di
                  User Attivo 5
                  #8

                  maxgiuliani

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

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

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

                  1 Risposta Ultima Risposta
                  Miglior risposta 0
                  0
                  • M
                    M
                    manetta
                    scritto su ultima modifica di
                    User Attivo 5
                    #9

                    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[$i]; 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[$i]; 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[$i]; 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[$i]; 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[$i]; 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[$i]; 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(); ?>
                    
                    1 Risposta Ultima Risposta
                    Miglior risposta 0
                    0
                    • M
                      M
                      maxgiuliani
                      scritto su ultima modifica di
                      User 0
                      #10

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

                      unexpected '}'

                      1 Risposta Ultima Risposta
                      Miglior risposta 0
                      0
                      • M
                        M
                        maxgiuliani
                        scritto su ultima modifica di
                        User 0
                        #11

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

                        1 Risposta Ultima Risposta
                        Miglior risposta 0
                        0
                        • M
                          M
                          maxgiuliani
                          scritto su ultima modifica di
                          User 0
                          #12

                          macché...
                          syntax error, unexpected $end

                          1 Risposta Ultima Risposta
                          Miglior risposta 0
                          0
                          • M
                            M
                            manetta
                            scritto su ultima modifica di
                            User Attivo 5
                            #13

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

                            1 Risposta Ultima Risposta
                            Miglior risposta 0
                            0
                            • M
                              M
                              maxgiuliani
                              scritto su ultima modifica di
                              User 0
                              #14

                              Eccolo qua: wordpress.org/extend/themes/cover-wp

                              1 Risposta Ultima Risposta
                              Miglior risposta 0
                              0
                              • M
                                M
                                maxgiuliani
                                scritto su ultima modifica di
                                User 0
                                #15

                                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?

                                1 Risposta Ultima Risposta
                                Miglior risposta 0
                                0
                                • M
                                  M
                                  manetta
                                  scritto su ultima modifica di
                                  User Attivo 5
                                  #16

                                  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[$i]; 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[$i]; 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[$i]; 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[$i]; 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[$i]; 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[$i]; 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(); ?>
                                  
                                  1 Risposta Ultima Risposta
                                  Miglior risposta 0
                                  0
                                  • M
                                    M
                                    maxgiuliani
                                    scritto su ultima modifica di
                                    User 0
                                    #17

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

                                    1 Risposta Ultima Risposta
                                    Miglior risposta 0
                                    0

                                    Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

                                    Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

                                    Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

                                    Registrati Accedi
                                    Rispondi
                                    • Risposta alla discussione
                                    Effettua l'accesso per rispondere
                                    • Da Vecchi a Nuovi
                                    • Da Nuovi a Vecchi
                                    • Più Voti


                                    • Accedi

                                    • Non hai un account? Registrati

                                    • Accedi o registrati per effettuare la ricerca.
                                    • Primo post
                                      Ultimo post
                                    Home Accedi Registrati
                                    Menu
                                    • CATEGORIES
                                    • La Community Connect.gt
                                    • Presentati alla Community
                                    • News Ufficiali da Connect.gt
                                    • Internet News
                                    • A Scuola Di
                                    • Digital Marketing
                                    • Intelligenza Artificiale
                                    • SEO & GEO
                                    • Web Marketing e Content
                                    • Google Analytics e Web Analytics
                                    • Google Ads & Advertising
                                    • YouTube
                                    • TikTok, Instagram e altri Social
                                    • Google Adsense, Affiliazioni e Guadagno
                                    • E-Commerce
                                    • Coding e Sistemistica
                                    • Help Center: consigli per il tuo progetto
                                    • Hosting e Cloud
                                    • Coding
                                    • CMS & Piattaforme Self-Hosted
                                    • Annunci e Collaborazioni
                                    • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
                                    • Collaborazioni WEB e Lavoro: offro e cerco
                                    • Impresa, Fisco e Leggi
                                    • Consulenza Legale e Professioni Web
                                    • Consulenza Fiscale, Imprese, Startup e P.Iva
                                    • Gli Off Topic
                                    • PC, Smartphone e altri Hardware
                                    • Tutti i Software
                                    • GT Fetish Cafè
                                    • Discussioni
                                    • Non letti 0
                                    • Recenti
                                    • Hashtag
                                    • Popolare
                                    • Utenti
                                    • Privacy
                                    • Termini e condizioni
                                    • © 2026 Search On Media Group S.r.l.