• My news section on the frontpage is organized in two parts.

    1. Featured sections (runs by Featured category).
    2. The rest of the news

    The problem is that the rest of the news shows the same news as in the featured section.
    I have been thinking for a solution. I could create a categori for the news section to show all my news in but not the featured news. Or I could set it to only show all news from news 4-15 because 1-3 is in the featured section. I liked the last solution best.

    Any ideas and recommandations? And do anyone have the code for this last solution?

Viewing 7 replies - 1 through 7 (of 7 total)
  • YOu can do this by using query posts
    http://codex.wordpress.org/Template_Tags/query_posts

    to show 12 posts offsetting the first three, try on the index page
    query_posts('showposts=12&offset=3');

    There are many examples in that codex reference. Hope this helps.

    Thread Starter Joakim

    (@jokka)

    Hmm, I’m so confused about the code in the theme (not my theme).
    Do you know what I will have to do?
    I want my news to be shown like the 2 news in the “Siste nyheter” section.

    Link to the site

    <div id="list-categories">
    				<h2 class="section-title"><?php _e( 'Siste nyheter', 'wpbx' ) ?></h2>
    <?php
    	// Flag to indicate alternating columns
    	$catLeftCol = true;
    	$intCount = 0;
    
    	// Determine how many posts to show per category
    	$intPostCount = 5;
    
    	// Retrieve a list of selected categories
    	$categories = get_categories("orderby=ID&order=asc&hide_empty=1&hierarchial=0&include=$front_cat_list");
    
    	// Iterate over each category
    	foreach ($categories as $category)
    	{
    		// Retrieve a handful of posts for this category
    		query_posts("cat=" . $category->cat_ID . "&showposts=$intPostCount&orderby=date&order=DESC");
    
    		// Increment the debug counter
    		$intCount++;
    
    ?>
    		<!-- Loop: <?php echo $intCount; ?> -->
    <?php
    		// Initialise the thumb display flag
    		$catFirstPost = true;
    
    		// Do we have any categories to display?
    		while (have_posts())
    		{
    
    			// Advance the post queue
    			the_post(); $do_not_duplicate = $post->ID;
    
    			// Is this the first post in the category?
    			if ($catFirstPost)
    			{
    ?>
    <?php
    			// Check whether we need to create the "row wrapper"
    			if ($catLeftCol)
    			{
    ?>
    				<div class="entry-row clearfix">
    <?php
    			}
    ?>
    
    					<div id="<?php echo $category->slug; ?>-list" class="entry-list">
    						<h3 class="entry-list-cat-title">
    							<a href="<?php echo get_category_link($category->cat_ID); ?>" title="More articles in <?php echo $category->name; ?>"><?php echo $category->name; ?> &raquo;</a>
    						</h3>
    
    						<div class="entry-list-thumb">
    							<a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
    							<?php
    							$entry_preview = get_post_custom_values("entry-preview");
    							if ( is_array($entry_preview) ) { ?>
    								<img class="entry-preview" src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, 'entry-preview',true) ?>&amp;w=258&amp;h=110&amp;zc=1" alt="<?php the_title(); ?>" />
    							<?php }	else { ?>
    								<img class="entry-preview" src="<?php bloginfo('template_directory'); ?>/images/image-blank-big.jpg" alt="<?php the_title(); ?>" />
    							<?php }	?>
    							</a>
    						</div>
    
    <h4 class="entry-list-title"><a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>"><?php the_title(); ?></a></h4>
    
    						<div class="entry-list-content">
    							<?php the_content_limit(85, ''); ?>
    						</div>
    
    						<p class="more-link">More in <?php echo $category->name; ?>
    
    						<ul>
    <?php
    				// First post display is complete
    				$catFirstPost = false;
    				the_post() == $do_not_duplicate;
    
    			} // if ($catFirstPost)
    ?>
    
    							<li class="clearfix">
    								<span class="entry-star"><img src="<?php bloginfo('template_directory'); ?>/images/bullet-star.png" alt="#" /></span>
    								<h4><a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>"><?php the_title(); ?></a></h4>
    								<div class="entry-meta">
    									<span class="entry-date"><?php unset($previousday); printf( __( '%1$s', 'wpbx' ), the_date( 'D, M j Y', '', '', false ) ) ?></span>
    									<span class="entry-meta-sep">|</span>
    									<span class="entry-comm"><?php comments_popup_link( __( 'No Comments', 'wpbx' ), __( '1 Comment', 'wpbx' ), __( '% Comments', 'wpbx' ) ) ?></span>
    								</div>
                                </li>
    
    <?php
    		} // while (have_posts())
    ?>
    						</ul>
    					</div>
    
    <?php
    		/*
    			If we've run out of posts to display, we need to close the "row"
    		*/
    		if (!$catLeftCol)
    		{
    ?>
    				</div><!-- .entry-row -->
    
    <?php
    		}
    
    		// Toggle the alternator
    		$catLeftCol = !$catLeftCol;
    
    	} // end foreach category
    
    	// Account for odd number of posts
    	if (!$catLeftCol)
    	{
    ?>
    				</div><!-- .entry-row -->
    
    <?php
    	}
    ?>		
    
    			</div><!-- #list-categories -->
    Thread Starter Joakim

    (@jokka)

    And by the way.. I dont think the solution to take out the 3 first news will be the best solutions since the featured section takes news from a certain category. I think the best solution the will be to exclude that category from the latest news section.

    But I still need help to edit the weird code.

    Thanks for all help! 🙂

    The Stars theme comes with a read me text file with instructions.

    4. Front page – home.php
    a. Featured posts
    Assign your “featured posts” into a category (ie. featured), then specify the “featured” category ID in home.php line #3 ($headline_cat)

    b. Front page categories
    The front page “Latest News” section displaying your 5 latest posts grouped by category, you can select which categories to display here by edit the home.php file on line #4 ($front_cat_list)

    You have to look at home.php and set the categories there. Doing that will probably give you the results you are looking for.

    Thread Starter Joakim

    (@jokka)

    No.

    I want to remove the section they have to only show some news from a category and then show all news..

    Thread Starter Joakim

    (@jokka)

    Okay..

    The only thing I want to do is to have the ability to show my all my news in two columns with image, title and text.. It is that easy.. But I have never done that before.. And I think the real problem is to get it in 2 columns.. Somebody?

    Thread Starter Joakim

    (@jokka)

    I think I got it working! yeeey My website

    BUT… There is another thing.. I would like to put something in between my news.. Ads and other thing like some photos etc.. How can I do this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘News section’ is closed to new replies.