Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 2 of 2 FirstFirst 1 2
Results 11 to 14 of 14
  1. #11
    Senior Member Hitch - CP's Avatar
    Join Date
    Jun 2009
    Location
    London
    Posts
    120
    Member #
    19164
    Yup, category 7 ....accept now http://collossalpixel.com/cp-blog/

    Interesting outcome
    Ali Hitch

    Portfolio & Tutorial Site
    www.alihitch.com

  2.  

  3. #12
    Senior Member Danny[MLWA]'s Avatar
    Join Date
    Jun 2009
    Location
    Goldsboro, North Carolina, USA
    Posts
    109
    Member #
    19147
    Liked
    5 times
    FYI: Do not click on the above link lol, it will crash your browser as it is an endless loop of a post (so it will give ya buffer over-runs).

    This should work:
    Code:
    <?php get_header(); ?>
    
        <div id="blog-image">
        <img src="http://www.collossalpixel.com/wp-content/themes/cp-v2/images/blog-banner.jpg" border=0 width="935" height="325" alt="Collossal Pixel Blog Banner" />
        </div><!--end #blog-image-->
    
        <div class="content">
        <?php query_posts('cat=7'); ?>
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                
            <div class="post" id="post-<?php the_ID(); ?>">
    
                <h2><?php the_title(); ?></h2>
    
                <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
    
                <div class="entry">
    
                    <?php the_content(); ?>
    
                    <?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
    
                </div>
    
                <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    
            </div>
    
            <?php endwhile; endif; ?>
        </div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
    Lead Web Designer
    MLW & Associates, LLP.
    W3C Standards Complaint and SEO Friendly
    Admin of Vraul
    WordPress.org Developer

  4. #13
    Senior Member Hitch - CP's Avatar
    Join Date
    Jun 2009
    Location
    London
    Posts
    120
    Member #
    19164
    No crashes anymore!

    Many thanks for that. So how did you fix that? I'm not massively experienced with php ...

    I can see you just moved the position of the coding but I don't quite understand how the php here works.

    The code below must obviously stop the looping, but could you please explain it by breaking it down for me?

    Code:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    Many thanks for all of this help Danny!
    Ali Hitch

    Portfolio & Tutorial Site
    www.alihitch.com

  5. #14
    Senior Member Danny[MLWA]'s Avatar
    Join Date
    Jun 2009
    Location
    Goldsboro, North Carolina, USA
    Posts
    109
    Member #
    19147
    Liked
    5 times
    Here is the code again with some explanatory comments =)
    Code:
    <?php /* Template Name: MyCustom1 */ ?>
    
    <?php get_header(); ?>
    
        <div id="blog-image">
        <img src="http://www.collossalpixel.com/wp-content/themes/cp-v2/images/blog-banner.jpg" border=0 width="935" height="325" alt="Collossal Pixel Blog Banner" />
        </div><!--end #blog-image-->
    
        <div class="content">
        <?php query_posts('cat=7'); // this builds the query, and caches it in php
                                    // So it is getting all of the posts in category
                                    // 7. 
                                    ?>
        <?php if (have_posts()) : while (have_posts()) : the_post(); // Now it LOOPS
                                    // through the posts that were queried and cached
                                    // above 
                                    ?>
                
            <div class="post" id="post-<?php the_ID(); // This grabs the post ID 
                                    // from the current post that is being looped out
                                    ?>">
    
                <h2><?php the_title(); // This grabs the title of the post being looped
                                    ?></h2>
    
                <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
    
                <div class="entry">
    
                    <?php the_content(); // This is the content of the post being looped
                                    ?>
    
                    <?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
    
                </div>
    
                <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    
            </div>
    
            <?php endwhile; endif; // Everything between this point and while (have_posts())
                                    // will duplicate itself for each post it queries.
                                    // of course the content that is pushed out is not a 
                                    // duplicate by all means.
                                    ?>
        </div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
    Lead Web Designer
    MLW & Associates, LLP.
    W3C Standards Complaint and SEO Friendly
    Admin of Vraul
    WordPress.org Developer


Page 2 of 2 FirstFirst 1 2

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:39 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com