Forums

changing theme to grab posts from category instead of everything (1 post)

  1. RyanColins
    Member
    Posted 1 year ago #

    Hi, I want to make a little change to a theme I'm using, but am still new to wordpress and php in general, so I'm a little lost. I'm using the reflection theme with the yet another photoblog plugin in. My only problem is that the gallery page displays all the picture and then separates them by year. What I need it to do is simply pull all the pictures from a category, then display all of them.

    The category it needs to pull it from will be the title/name of the page, so I know I would use the php <?the_title();?> here, but the rest of the wordpress calls mystify me. Any help would be great.

    Heres the code from the gallery page:

    <?php
    
    $posts = get_posts('numberposts=-1&order=DESC');
    
    $postyear = 0;
    
    foreach ($posts as $post) {
    	$this_postyear = intval(substr($post->post_date, 0, 4));
    
    	if ($this_postyear != $postyear) {
    		$postyear = $this_postyear;
    		echo '<h2 class="mosaicheader">'.$postyear.'</h2>';
    	}
    
    	$image = YapbImage::getInstanceFromDb($post->ID);
    
    	if ($image->width > $image->height) {
    		$thumb_param = array(
    			'sx='.intval(($image->width - $image->height)/2),
    			'sy=0',
    			'sw='.$image->height,
    			'sh='.$image->height
    		);
    	} elseif ($image->width < $image->height) {
    		$thumb_param = array(
    			'sx=0',
    			'sy='.intval(($image->height - $image->width)/2),
    			'sw='.$image->width,
    			'sh='.$image->width
    		);
    	} else {
    		$thumb_param = array();
    	}
    
    	array_push($thumb_param, 'h=100', 'q=70');
    	echo '<a href="'.get_permalink($post->ID).'">';
    	echo '<img class="thumb" src="'.$image->getThumbnailHref($thumb_param).'" />';
    	echo '</a>';
    }
    
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.