• So i got this thing going where i need one categorie (lets say cat=8) to go on a extra page in stead of only on the blog. And i know you can do it trough category page but that’s not what i need. I looked and looked and found something usefull.
    <?php query_posts("cat=8"); ?>
    Ok so this works but then the posts come in full length, now i need them to be exactly as on my homepage. (maybe link can help, BitNerds, i am talking about the atari 2600 game page under atari>atari2600>2600games.
    I don’t know what i am doing wrong but here is the code of my extra page.

    <?php
    /*
    Template Name: my page
    */
    ?>
    <?php get_header(); ?>
    
    <div id="container">
    
    	<div id="homearticle">
    				<?php $wp_query = new WP_Query(array('cat'=>of_get_option('home_feature'),'posts_per_page'=>100)); ?>
    <?php query_posts("cat=8"); ?>
    <?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
                    <?php $meta_box = get_post_custom($post->ID); $video = $meta_box['custom_meta_video'][0]; ?>
                    <?php global $more; $more = 0; ?>
    
                        <?php if ( $video ) : ?>
                            <div class="feature_video"><?php echo $video; ?></div>
                        <?php else: ?>
                            <a class="feature_img" href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail( 'home-feature' ); ?></a>
                        <?php endif; ?>
                        <div class="feature_info">
                            <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
                            <?php the_excerpt(); ?>
                        </div>
    
                    <?php endwhile; ?>
                    <?php else : ?>
                    <?php endif; ?>
    	        </div>
    
    <?php include(TEMPLATEPATH."/sidebar.php");?>
    
    </div>
    
    <?php get_footer(); ?>

    Now i am not new to php, but just rusty actualy. I just think i mixed up to much to let it work. Please help

    ****EDIT***
    Apperantly it has something to do with the <?php query_posts("cat=8"); ?> because when i leave it out i see one post like it should be, but still i’ve got the problem of the category and multiple posts

Viewing 6 replies - 1 through 6 (of 6 total)
  • I’d first try by changing the $wp_query instead of using <?php query_posts("cat=8"); ?>

    change this line:
    <?php $wp_query = new WP_Query(array('cat'=>of_get_option('home_feature'),'posts_per_page'=>100)); ?>
    to
    <?php $wp_query = new WP_Query(array('cat'=>8,'posts_per_page'=>100)); ?>

    then delete <?php query_posts("cat=8"); ?>

    Thread Starter stijnnoordman

    (@stijnnoordman)

    nice thx a lot

    Thread Starter stijnnoordman

    (@stijnnoordman)

    is it btw possible to get the posts in alphabetic order? using the following code:

    <?php
    /*
    Template Name: my page
    */
    ?>
    <?php get_header(); ?>
    
    <div id="container">
    
    	<div id="homearticle">
    				<?php $wp_query = new WP_Query(array('cat'=>8,'posts_per_page'=>100)); ?>
    <?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
                    <?php $meta_box = get_post_custom($post->ID); $video = $meta_box['custom_meta_video'][0]; ?>
                    <?php global $more; $more = 0; ?>
                        <div class="feature_info">
                            <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
                            <?php the_excerpt(); ?>
                        </div>
    
                    <?php endwhile; ?>
                    <?php else : ?>
                    <?php endif; ?>
    	        </div>
    
    <?php include(TEMPLATEPATH."/sidebar.php");?>
    
    </div>
    
    <?php get_footer(); ?>

    Change:
    <?php $wp_query = new WP_Query(array('cat'=>8,'posts_per_page'=>100)); ?>

    to

    <?php $wp_query = new WP_Query(array('cat'=>8,'posts_per_page'=>100, 'orderby' => 'title')); ?>

    this page will be your best friend when it comes to customizing the query.

    Thread Starter stijnnoordman

    (@stijnnoordman)

    thx but doesn’t seem to do anything, i read the page on the class reference query but everything i try doesn’t work

    Thread Starter stijnnoordman

    (@stijnnoordman)

    ok think i found it in stead of your code
    <?php $wp_query = new WP_Query(array('cat'=>8,'posts_per_page'=>100, 'orderby' => 'title')); ?>
    i did this
    <?php $wp_query = new WP_Query(array('cat'=>8,'posts_per_page'=>100, 'order'=>'DESC')); ?>
    And it worked for me. thx for your help bythegram

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Various posts on extra page’ is closed to new replies.