| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 
 | <?php 
$x = 1;
if(is_home()) { 
	$options = get_option("widget_sideFeature");
 	$numberOf = $options['number'];
	$category = $options['category'];
	$category = "&cat=" . $category;
	$showposts = "posts_per_page=" . $numberOf . $category ;
	$featuredPosts = new WP_Query();
    $featuredPosts->query($showposts);
	while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); 
		$notin[] = $post->ID;
	endwhile;
 
	$posts = pbt_theme_option('number_posts');
    if(empty($posts)) $posts = 6;
	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    if (is_active_widget('widget_myFeature')) {
        $args = array(
           'post__not_in'=>$notin,
           'posts_per_page'=>$posts,
           'paged'=>$paged
           );
    } else {
        $args = array(
           'posts_per_page'=>$posts,
           'paged'=>$paged
           );
    }       	
    query_posts($args);
 if (function_exists (horizontal_scrolling_announcement)) horizontal_scrolling_announcement();
 
}
?>
 
<?php if(!have_posts()) : ?>
	<div id="post-0" class="post error404 not-found">
		<h1><?php _e( 'Aucun résultat', "magazine-basic" ); ?></h1>
		<div class="entry-content">
			<p><?php _e( 'Pas de résultat pour votre recherche.', "magazine-basic" ); ?></p>
		</div><!-- .entry-content -->
	</div><!-- #post-0 -->
<?php endif; ?>
 
<?php 
if(is_search()) {
    $mySearch =& new WP_Query("s=$s & showposts=-1");
    $num = $mySearch->post_count;
    echo '<h1 class="catheader">'.$num. __(' résultat(s)', "magazine-basic").' "'; the_search_query(); echo '"</h1>';
}
?>
<?php while ( have_posts() ) : the_post(); ?>
	<?php
	$wordlimit = pbt_theme_option('excerpt_one');
	?>
	<div id="post-<?php the_ID(); ?>" <?php post_class($classes); ?>>
		<?php 
		if(is_singular()) {
			if(function_exists('has_post_format') && has_post_format('aside')) { // new aside post format
				echo '<div class="entry">';
					the_content();
				echo '</div>';
			} else {
        		?>
                <h3><?php the_title(); ?></h3>
                <?php
                if(is_single()) {
	                echo '<div class="meta">';
	                    if(pbt_theme_option('dates_posts')=='on') { echo '<div class="date">'; the_time(get_option('date_format')); echo '</div>'; }
	                    if(pbt_theme_option('authors_posts')=='on') { _e("By", "magazine-basic"); echo ' '; the_author_posts_link(); }
	                echo '</div>';
                }
                echo '<div class="entry">';
                    $subtitle = get_post_meta($post->ID, 'subtitle', true);
                    if($subtitle) echo '<p class="sub">'.$subtitle.'</p>';
                    the_content(__('Lire »', "magazine-basic"));
                    wp_link_pages(array('before' => '<p><strong>'.__('Pages', "magazine-basic").':</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
                    the_tags(__('<p class="tags"><small><strong>Tags:</strong> ', "magazine-basic"), ', ', '</small></p>'); 
                echo '</div>';
			}
		} else { 
        	if(function_exists('has_post_format') && has_post_format('aside')) { // new aside post format
				echo '<div class="entry">';
					pbt_theme_excerpt($wordlimit);
				echo '</div>';
			} elseif(function_exists('has_post_format') && has_post_format('link')) { // new link post format
				echo '<div class="entry">';
					the_content(__('Lire »', "magazine-basic"));
				echo '</div>';
			} else {
				?>
				<h2><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', "magazine-basic" ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
				<?php
				echo '<div class="meta">';
				if(is_home()) {
					if(pbt_theme_option('dates_index') == 'on') { echo '<div class="date">'; the_time(get_option('date_format')); echo '</div>'; }
					if(pbt_theme_option('authors_index') == 'on') { _e("By", "magazine-basic"); echo ' '; the_author_posts_link(); }
				} else {
					if(pbt_theme_option('dates_cats') == 'on') { echo '<div class="date">'; the_time(get_option('date_format')); echo '</div>'; }
					if(pbt_theme_option('authors_cats') == 'on') { _e("By", "magazine-basic"); echo ' '; the_author_posts_link(); }
				}
				echo '</div>';
				echo '<div class="entry">';
				if(function_exists('has_post_format') && has_post_format('gallery')) { // new gallery post format
					$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
					if ( $images ) :
						$total_images = count( $images );
						$image = array_shift( $images );
						$image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
					?>
					<a class="gallery-thumb" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
					<p><em><?php printf( _n( 'Cette galerie contient <a %1$s>%2$s photo</a>.', 'Cette galerie contient <a %1$s>%2$s photos</a>.', $total_images, "magazine-basic" ),
							'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', "magazine-basic" ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
							number_format_i18n( $total_images )
						); ?></em>
					</p>
					<?php endif; ?>
					<?php 
				} else {
					if(function_exists('has_post_format') && (has_post_format('video') || has_post_format('image') || has_post_format('audio'))) { // new video || image || audio post format
                    	echo '<div class="pformat">';
						the_content(__('Lire »', "magazine-basic"));
						echo '</div>';
					} else {
						if(pbt_theme_option('excerpt_content')!=2) {
							if(function_exists('has_post_thumbnail') && has_post_thumbnail()) { 
								echo '<a href="'.get_permalink().'">';
								the_post_thumbnail('thumbnail', array('class' => 'alignleft'));
								echo '</a>';
							} else { 
								echo pbt_resize(get_option('thumbnail_size_w'),get_option('thumbnail_size_h')); 
							}
							/*if(function_exists('has_post_thumbnail') && has_post_thumbnail()) { 
								echo '<a href="'.get_permalink().'">';
								if($x==1) {
								  the_post_thumbnail(array(150,150), array('class' => 'alignleft'));
								} elseif($x>1 && $x<4) {
								  the_post_thumbnail(array(100,100), array('class' => 'alignleft'));
								} else {
								  the_post_thumbnail(array(80,80), array('class' => 'alignleft'));
								}		
								echo '</a>';
							} else { 
								if($x==1) {
									echo pbt_resize(150,150); 
								} elseif($x>1 && $x<4) {
									echo pbt_resize(100,100); 
								} else {
									echo pbt_resize(80,80); 
								}								
							}*/
							pbt_theme_excerpt($wordlimit);
						} else {
							the_content(__('Lire »', "magazine-basic"));
						}
					}
				}
				echo '</div>';
			} 
		} 
		?>
	</div><!-- #post-## -->
   	<?php comments_template(); ?>
    <?php 
	$x++; // counter 
	?>   
<?php endwhile; ?>
<?php if(($optionlayout==2 || $optionlayout==3 || $optionlayout==4) && $x>1 && $paged < 2 && is_home()) echo '</div>'; ?>
<?php if($optionlayout==3 && $x>3 && $paged < 2 && is_home()) echo '</div>'; ?>
<?php if($optionlayout==4 && $x>1 && $paged < 2 && is_home()) echo '</div>'; ?>
<?php if(!is_single()) if(function_exists('pbt_pagination')) { pbt_pagination(); } ?>
 
2. Voici le code que j'ai préparé...
 
if (is_home()) {
 
	$querystr = "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE $wpdb->posts.post_date < NOW() ";
	$accueil = $wpdb->get_results($accueil1, OBJECT);
	if ($accueil): 
		global $post;
		foreach ($accueil as $post):
		setup_postdata($post);
 
(je ne sais pas où insérer la première et deuxième partie de mon code)
 
                           endforeach;
		endif;
	} | 
Partager