Support » Fixing WordPress » Adding full content from all posts in category to footer

  • Resolved dustyseb

    (@dustyseb)


    Hi.

    In the footer of every page I want to display the full content of a certain category.

    I’ve tried:

    <?php
            global $post;
            $myposts = get_posts('numberposts=4&category=3');
            foreach($myposts as $post) :
            ?>
            <ul>
    		<li><?php the_excerpt(); ?></li>
     	</ul>
            <?php endforeach; ?>

    but that just spits out the content from the main page.php

    Help is greatly appreciated. Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Does this work for you?

    <?php $posts = query_posts( 'showposts=4&cat=3' ); ?>
    <?php if( $posts ) : ?> 
    
    <?php foreach( $posts as $post ) : setup_postdata( $post ); ?> 
    
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    
    <?php endforeach; ?> 
    
    <?php endif; ?>
    Thread Starter dustyseb

    (@dustyseb)

    Hmm, that somehow breaks the entire page, empty?

    http://dustybrush.net/onecall/onenumber-priser/

    <?php the_content('Read the rest of this entry &raquo;'); ?>

    I dont want any links, just display the posts of cat 3 in their entirety – if that’s at all doable. I am setting up a cms for a client and I want them to be able to edit the footer content, which is divided into 4 parts horizontally (unordered list). Posts in the footer would be category “footer” (id 3).

    Thanks for the super fast reply! 🙂

    I know you didn’t want any links in the cat 3 posts in the footer but I’ve got this code to work in my site now.

    <?php $posts = query_posts( 'showposts=4&cat=3' ); ?>
    <?php if( $posts ) : ?>
     <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
    <div class="entry"> ***REPLACE THIS WITH YOUR OWN CLASS FOR ENTRIES***
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    </div>
    <?php endforeach; ?>
    <?php endif; ?>
    Thread Starter dustyseb

    (@dustyseb)

    thanks again,

    its still a bit strange. still breaks the site and leaves it empty

    here’s my footer.php:

    <div class="kolo">
    
    <?php $posts = query_posts( 'showposts=4&cat=3' ); ?>
    <?php if( $posts ) : ?>
     <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
    <div class="entry"> ***REPLACE THIS WITH YOUR OWN CLASS FOR ENTRIES***
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    </div>
    <?php endforeach; ?>
    <?php endif; ?>
    
        <div class="FooterWide">
    		<?php bloginfo('name'); ?> powered by <a href="http://wordpress.org/">WordPress</a> | <a href="<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a> | <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. -->Denne side blev genereret p&aring; <?php timer_stop(1); ?> sekunder | Design Sebastian Larsen
    	</div>
    
    	</div>
       </div>
    
    <?php wp_footer(); ?>
    </body>
    </html>

    I am stumped.

    Well, here’s mine for what it’s worth…

    <div id="footer">
    <?php wp_footer(); ?>
    
    <?php $posts = query_posts( 'showposts=4&cat=106' ); ?>
    <?php if( $posts ) : ?>
     <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
    <div class="entry">
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    </div>
    
    <?php endforeach; ?>
    <?php endif; ?>  
    
    			<div class="padding">
    				My own footer content is here
    			</div>
    		</div>

    I’m using a edited version of the ‘Sunrise’ theme to test this instead of my usual theme. I will leave the test theme active for half an hour to give you chance to see it working.

    oops! the site is http://www.langhofc.com

    Thread Starter dustyseb

    (@dustyseb)

    ok thanks.

    it does works for you. This is really bizarre.

    I’ll test on page.php a bit later to see if that makes a difference. Right now, I am having a slight fever, need to lie down for an hour 🙂

    Thread Starter dustyseb

    (@dustyseb)

    same thing in page.php.

    the code breaks the entire site and leaves it blank. No source code, no nothing :-/

    Thread Starter dustyseb

    (@dustyseb)

    anyone?

    Thread Starter dustyseb

    (@dustyseb)

    solved it, using Guff’s get-a-post plugin.

    http://guff.szub.net/2005/01/27/get-a-post/

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Adding full content from all posts in category to footer’ is closed to new replies.