This must be simple, but I just can't do it!

Hi Everyone!

I’m a newbie to PHP…I have experience in HTML and CSS but PHP is a whole new ball game to me. I’m trying to do something which must be SO simple, but because I just can’t understand PHP I’m not able to do it. I literally just want to switch the position of one item on my wordpress site…

Here is the PHP coding for the page…

[php]

<?php // get the selected homepage $homepage = new WP_Query( "showposts=1&post_type=page&page_id=".get_option('page_on_front') ); while ($homepage->have_posts()) : $homepage->the_post(); ?>
	<?php the_content(); ?>
</div>
<?php endwhile; ?> <?php wp_reset_query(); ?>
<?php
	// the thumbnail strip
	
	$slideshow = new WP_Query('posts_per_page='.ide_option('homepage_slideshow_num').'&cat='.ide_option('homepage_slideshow'));
	if($slideshow->have_posts()):
?>
<?php while($slideshow->have_posts()): $slideshow->the_post(); ?>
		<div class="slide">
			<?php if(has_post_thumbnail($post->ID)): ?>
				<a href="<?php the_permalink(); ?>" class="thumb"><?php the_post_thumbnail( 'large' ); ?><span><?php the_title(); ?></span></a>
			<?php else: ?>
				<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
				<div class="text"><?php the_excerpt(); ?></div>
			<?php endif; ?>
			<div class="meta">
				<span class="date"><?php the_time(get_option('date_format')); ?></span> &mdash;
				<span class="category"><?php the_category(', '); ?></span>
			</div>
			<div class="clear"> </div>
		</div>
		
		<?php endwhile; ?>

	</div>
	<script type="text/javascript">
	//<![CDATA[
		var ide_autoslide = <?php echo ide_option('homepage_autoslide') ? 'true' : 'false'; ?>;
	//]]>
	</script><?php
	endif;
	wp_reset_query();
	

	// the thumbnail strip
	
	$strip = new WP_Query('posts_per_page='.ide_option('homepage_thumbstrip_num').'&cat='.ide_option('homepage_thumbstrip'));
	if($strip->have_posts()):
?>
	<ul class="strip noul">
		<li class="title"><?php the_category(' '); ?></li>

		<?php while($strip->have_posts()): $strip->the_post(); ?>
		<li>
			<span class="date"><?php the_time(get_option('date_format')); ?></span>
			<div class="clear"> </div>
			<a href="<?php the_permalink(); ?>" class="thumb"><?php the_post_thumbnail( 'tiny' ); ?></a>
			<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
			<div class="clear"> </div>
		</li>
		<?php endwhile; ?>

	</ul>


	<div class="clear"> </div>

<?php
	endif;
	wp_reset_query();
	
	// featured category blocks
	
	$featured_cats = ide_option('homepage_featured');
	if($featured_cats[0] == '-') { // all categories
		$featured_cats = get_all_category_ids();
	}
	
	foreach($featured_cats as $cat_id):
		$category = get_category($cat_id);

		$featured = new WP_Query( "posts_per_page=".ide_option('homepage_featured_num')."&cat=".$cat_id );
?>
	<ul class="featured noul">
		<li class="title"><a href="<?php echo get_category_link($cat_id); ?>" title="<?php echo $category->name; ?>"><?php echo $category->name; ?></a></li>

		<?php
			if ( $featured->have_posts() )		
			while ( $featured->have_posts() ) : $featured->the_post();
			// rest of the posts with thumbnail images
		?>
		<li class="entry">
			<?php if(has_post_thumbnail($post->ID)): ?>
				<a href="<?php the_permalink(); ?>" class="thumb"><?php the_post_thumbnail(); ?></a>
				<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
			<?php else: ?>
				<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
				<div class="text"><?php echo get_the_excerpt(); ?></div>
			<?php endif; ?>
			<div class="meta">
				<span class="date"><?php the_time(get_option('date_format')); ?></span>
			</div>			

			<div class="clear"> </div>
		</li>
		<?php endwhile; ?>

	</ul>




	<?php endforeach; ?>



	<div class="clear"> </div>
[/php]

Any help would be MUCH appreciated. Thank you!

Hi. Try this, but make sure you have backup copy of your files (also something is wrong with formatting):
[php]

<?php // get the selected homepage $homepage = new WP_Query( "showposts=1&post_type=page&page_id=".get_option('page_on_front') ); while ($homepage->have_posts()) : $homepage->the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?> <?php wp_reset_query(); ?> <?php // featured category blocks $featured_cats = ide_option('homepage_featured'); if($featured_cats[0] == '-') { // all categories $featured_cats = get_all_category_ids(); } foreach($featured_cats as $cat_id): $category = get_category($cat_id); $featured = new WP_Query( "posts_per_page=".ide_option('homepage_featured_num')."&cat=".$cat_id ); ?> <?php endforeach; ?>
<?php // the thumbnail strip $slideshow = new WP_Query('posts_per_page='.ide_option('homepage_slideshow_num').'&cat='.ide_option('homepage_slideshow')); if($slideshow->have_posts()): ?>
<?php while($slideshow->have_posts()): $slideshow->the_post(); ?>
<?php if(has_post_thumbnail($post->ID)): ?> <?php the_post_thumbnail( 'large' ); ?><?php the_title(); ?> <?php else: ?>

<?php the_title(); ?>

<?php the_excerpt(); ?>
<?php endif; ?>
<?php the_time(get_option('date_format')); ?><?php the_category(', '); ?>
<?php endwhile; ?>
<?php endif; wp_reset_query(); // the thumbnail strip $strip = new WP_Query('posts_per_page='.ide_option('homepage_thumbstrip_num').'&cat='.ide_option('homepage_thumbstrip')); if($strip->have_posts()): ?>
<?php endif; wp_reset_query(); ?>

[/php]

Thank you SO much! That worked!!! I thought there was something wrong with the code…I purchased a template from a designer but I’ve been having a hard time editing it.

Whatever you did worked so thank you VERY very much!

Sponsor our Newsletter | Privacy Policy | Terms of Service