Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter OlyReeve

    (@olyreeve)

    I owe you a beer, thanks man.

    Thread Starter OlyReeve

    (@olyreeve)

    That gave me this error:
    Parse error: syntax error, unexpected T_FOREACH, expecting ‘,’ or ‘;’ in…

    Thanks

    Thread Starter OlyReeve

    (@olyreeve)

    Thanks guys that worked. Sorry keesiemeijer that was perfect. Thanks for your patience one and all. πŸ™‚

    Thread Starter OlyReeve

    (@olyreeve)

    Thanks for your help people, Kessitemeijer – it didn’t work, sorry. The page is a custom page template.

    Esmi I changed what you said but it’s given me an error, have I missed something?

    <?php
    /*
    Template Name: Blog Template
    */
    get_header(); ?>
    <div id="main">
              <div class="main-section">
                    <div class="headline">
                        <div class="holder">
                            <h1>Blog</h1>
                        </div>
                    </div>
                    <div class="main-content">
                        <?php
                $args=array(
    			'post_type' => 'post',
    			'post_status' => 'publish',
    			'posts_per_page' => 10,
    			'paged' => get_query_var('paged')
    			);
    
    			query_posts($args);
    			if( $my_query->have_posts() ) { ?>
    			<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    				<h3 class="category"><?php the_category();?> </h3>
    				<div class="blogContainer">
    					<div class="blogpiece">
    					<div class="titleMeta"><div class="metaDeets">by <?php the_author_posts_link(); ?> | <?php the_time('g:i') ?> | <?php the_time('d/m/Y') ?></div><h6><?php the_title(); ?></h6></div>
    					<div class="mainText">
    						<?php the_excerpt(); ?>
    					</div>
    					<div class="readMorebox"><a href="<?php echo get_permalink(); ?>">&raquo; Read more</a></div>
    					</div>
    				</div>
    			<?php endif; ?>
    									<?php posts_nav_link(' β€” ', __('&laquo; Newer Posts'), __('Older Posts &raquo;')); ?>
                    </div>
                </div>
    </div>
    <?php get_footer();?>
    Thread Starter OlyReeve

    (@olyreeve)

    I wish I knew how to! I’m an amateur and wouldn’t know hot to rewrite the code with query_posts(). Thanks for the advice though esmi.

    Thread Starter OlyReeve

    (@olyreeve)

    It’s a single loop. This is how my code looks with your nitin_8, it still doesn’t work:

    <div class="main-content">
                        <?php
                $args=array(
    			'post_type' => 'post',
    			'post_status' => 'publish',
    			'posts_per_page' => 10,
    			'paged' => get_query_var('paged')
    			);
    
    			$my_query = null;
    			$my_query = new WP_Query($args);
    			if( $my_query->have_posts() ) { ?>
    			<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    				<h3 class="category"><?php the_category();?> </h3>
    				<div class="blogContainer">
    					<div class="blogpiece">
    					<div class="titleMeta"><div class="metaDeets">by <?php the_author_posts_link(); ?> | <?php the_time('g:i') ?> | <?php the_time('d/m/Y') ?></div><h6><?php the_title(); ?></h6></div>
    					<div class="mainText">
    						<?php the_excerpt(); ?>
    					</div>
    					<div class="readMorebox"><a href="<?php echo get_permalink(); ?>">&raquo; Read more</a></div>
    					</div>
    				</div>
    			<?php endwhile; ?>
    									<?php posts_nav_link(' β€” ', __('&laquo; Newer Posts'), __('Older Posts &raquo;')); ?>
    
    			<?php }
    			wp_reset_query();
    			?>
    
                    </div>

    Thanks

    Thread Starter OlyReeve

    (@olyreeve)

    its a custom template file.

    Thread Starter OlyReeve

    (@olyreeve)

    Hey Matiniboy.

    Thanks for trying did you have any luck in the end? I’ve tried for the life of me to get it working but no luck!

    Thanks!

    Thread Starter OlyReeve

    (@olyreeve)

    Thanks Martiniboy but i got an error:
    Parse error: syntax error, unexpected T_VARIABLE on line 15

    Thread Starter OlyReeve

    (@olyreeve)

    Thanks for your patience. I just want the first post to appear differently to rest of the posts. I created two loops because I didn’t know how to make the first one different. This is probably the reason it’s messing up! Cheers!

    Thread Starter OlyReeve

    (@olyreeve)

    Thanks for your help, it’s still not quite working right, here’s my full code – it’s messy πŸ™‚

    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	<?php global $post;
    		$args = array( 'numberposts' => 1, 'child_of' => 6);
    		$myposts = get_posts( $args );
    		foreach( $myposts as $post ) :	setup_postdata($post); ?>
    			<div class="article">
    				<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    				<h5><?php the_category(', '); ?></h5>
    				<h4>Written <?php the_time('jS F Y') ?> by <?php the_author_posts_link(); ?></h4>
    				<a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail('large'); } ?></a>
    				<?php the_excerpt(); ?>
    			</div>
    	<?php endforeach; ?>
    <?php endwhile; ?>
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       $args = array( 'posts_per_page' => 2, 'child_of' => 6, 'offset' => 1, 'paged' => $paged);
       query_posts($args);
       if (have_posts()) : while (have_posts()) : the_post(); ?>
          <div class="articleOld">
             <a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail('medium'); } ?></a>
             <h4><?php the_time('jS F Y') ?> in <?php the_category(', '); ?></h4>
             <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
             <?php the_excerpt(); ?>
          </div>
    <?php endwhile; endif; ?>
    <?php posts_nav_link(' β€” ', __('Β« Newer Posts'), __('Older Posts Β»')); ?>

    and a link if you need to see whats going on, thanks!
    http://kitehub.co.uk/bude/beaches

Viewing 11 replies - 1 through 11 (of 11 total)