Hi,
ich habe ein Problem mit meinen als "sticky" markierten Posts. Die werden auf meiner index.php nicht so angezeigt, wie ich das will.
Ich benutze das freie Theme "Adapt", das ich für meine Zwecke leicht modifiziert habe. Normal werden in dem Theme vier Blog-Einträge nebeneinander dargestellt.
Ich habe es so verändert, dass nach den ersten vier Artikeln die Posts untereinander dargestellt werden (damit da auch noch eine Sidebar hinpasst, die im Original-Theme nicht vorgesehen ist) und benutze dafür einen zweiten Loop.
Das funktioniert ganz gut, siehe hier: http://www.gute-kinderb%c3%bccher.de
Sobald ich aber nun einen Beitrag auf "sticky" stelle, erscheint der an erster Position in der Reihe der untereinandergestellten Beiträge (2. Loop) - und nicht ganz vorne bei den vier Beiträgen, die nebeneinander dargestellt werden (1. Loop). Da so er aber hin...
Ich bin ratlos. Kann mir vielleicht jemand helfen?
Herzlichen Dank,
Matti
PS: Hier die relevante Stelle aus der index.php:
<!-- Recent Blog Posts -->
<?php
//get post type ==> regular posts
global $post;
$args = array(
'post_type' =>'post',
'numberposts' => '4'
);
$blog_posts = get_posts($args);
?>
<?php if($blog_posts) { ?>
<section id="home-posts" class="clearfix">
<h2 class="heading"><span><?php if(!empty($options['recent_work_text'])) { echo $options['recent_news_text']; } else { _e('Recent News','adapt'); }?></span></h2>
<?php
$count=0;
foreach($blog_posts as $post) : setup_postdata($post);
$count++;
//get portfolio thumbnail
$feat_img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'grid-thumb');
?>
<article class="home-entry <?php if($count == '4') { echo 'remove-margin'; } if($count == '3') { echo ' responsive-clear'; } ?>">
<?php if ($feat_img) { ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo $feat_img[0]; ?>" height="<?php echo $feat_img[2]; ?>" width="<?php echo $feat_img[1]; ?>" alt="<?php echo the_title(); ?>" /></a>
<?php } ?>
<div class="home-entry-description">
<?php $categories = get_the_category(); echo $categories[0]->cat_name; ?>
<?php wp_gdsr_render_article(10, false); ?>
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo the_title(); ?></a></h3>
<?php echo excerpt('20'); ?><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> mehr...</a>
</div>
<!-- /home-entry-description -->
</article>
<!-- /home-entry-->
<?php
if($count == '4') { echo '<div class="clear"></div>'; $count=0;}
endforeach; ?>
</section>
<?php get_sidebar(); ?>
<div id="post" class="post clearfix">
<?php //save old query
$temp = $wp_query;
//clear $wp_query;
$wp_query= null;
//create a new instance
$wp_query = new WP_Query();
$wp_query->query('showposts=10&offset=4');
while ($wp_query->have_posts()) : $wp_query->the_post();
//get featured img
$feat_img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'grid-thumb');
?>
<article class="loop-entry clearfix">
<?php if($feat_img) { ?>
<a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>" class="loop-entry-thumbnail"><img src="<?php echo $feat_img[0]; ?>" alt="<?php echo the_title(); ?>" /></a>
<?php } ?>
<?php $categories = get_the_category(); echo $categories[0]->cat_name; ?>
<?php wp_gdsr_render_article(10, false); ?>
<h2><a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php
//show meta only on blog posts
if ( get_post_type() != 'page' || get_post_type() != 'portfolio') { ?>
<div class="loop-entry-meta">
<span class="awesome-icon-calendar"></span><?php _e('Am','surplus'); ?> <?php the_time('j'); ?> <?php the_time('M'); ?>, <?php the_time('Y'); ?>
<span class="awesome-icon-user"></span><?php _e('Von', 'surplus'); ?> <?php the_author_posts_link(); ?>
<span class="awesome-icon-comments"></span><?php _e('Mit', 'surplus'); ?> <?php comments_popup_link('0 Kommentaren', '1 Kommentar', '% Kommentaren'); ?>
</div>
<!-- /loop-entry-meta -->
<?php } ?>
<?php echo excerpt('20'); ?><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> mehr...</a>
</article>
<!-- loop-entry -->
<?php endwhile;
//clear again
$wp_query = null;
//reset $wp_query = $temp;?>
Alles anzeigen