WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding full content from all posts in category to footer (11 posts)

  1. dustyseb
    Member
    Posted 5 years ago #

    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.

  2. thingymajig
    Member
    Posted 5 years ago #

    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; ?>
  3. dustyseb
    Member
    Posted 5 years ago #

    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! :)

  4. thingymajig
    Member
    Posted 5 years ago #

    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; ?>
  5. dustyseb
    Member
    Posted 5 years ago #

    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.

  6. thingymajig
    Member
    Posted 5 years ago #

    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.

  7. thingymajig
    Member
    Posted 5 years ago #

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

  8. dustyseb
    Member
    Posted 5 years ago #

    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 :)

  9. dustyseb
    Member
    Posted 5 years ago #

    same thing in page.php.

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

  10. dustyseb
    Member
    Posted 5 years ago #

    anyone?

  11. dustyseb
    Member
    Posted 5 years ago #

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

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

Topic Closed

This topic has been closed to new replies.

About this Topic