Photos-For-You.com update (30 of 1373 or so.)
Now that I am uploading new photos in some sort of coherent order, the 'Related Posts' plugin is making a lot more sense than it did before.
e.g. on the following post:-
Mushroom
It is suggesting similar photos that were most recently uploaded.
The only problem with a lot of the photos that I have tagged after uploading is that, quite often 'blank and white film' photos are all that is shown in 'related photos', as they just happened to be uploaded more recently than the colour photos.
I'm not sure the best way to get round this, apart from possibly changing it so that it only shows colour photos as default. Must think about it for a while...
Probably the best thing to do is show related photos from the category the current post is in e.g. if the current post is in the 'Colour Photos' category - then show related photos from the 'Colour Photos' category etc. (Must shuffle off now to read up a bit more on how to do this type of thing on Wordpress)...
Update - rather than doing a new post - after much consulting of Wordpress and php reference materials online - here is what I have hacked together into my single.php file in order to show related photos depending on which category the current photo is in (I'm sure there is a more efficient way to do it - but it seems to work so far):-
<div style="margin-top:-10px">
<?php
//for use in the loop, list 12 post titles related to first tag on current post
$category = get_the_category();
$firstcategory = $category[0]->cat_ID;
//if first category in array is photos then take next one, needed for Sepia photos for example
if ($firstcategory==3){
$firstcategory=$category[1]->cat_ID;
}
$tags = wp_get_post_tags($post->ID);
if ($tags) {
echo '<strong>Related Photos</strong><div style="clear:both;">';
$first_tag = $tags[0]->term_id;
$args=array(
'cat' => $firstcategory,
'tag__in' => array($first_tag),
'post__not_in' => array($post->ID),
'showposts'=>12,
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div style="float:left;width:130px;height:132px;border:1px solid #d8d8d8;margin:0 3px 5px 0;padding:3px;font-size:11px;line-height:13px;"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php
//the_title();
echo yapb_get_thumbnail(
'<div>', // HTML before image tag
array(
'alt' => 'Photo thumbnail', // image tag alt attribute
'rel' => 'lightbox' // image tag rel attribute
),
'</div>', // HTML after image tag
array('w=130', 'h=130', 'q=90'), // phpThumb configuration parameters
'thumbnail' // image tag custom css class
);
?>
</a></div>
<?php
endwhile;
}
}
?>
</div>
<div style="clear:both;">
And my related posts section now looks like this (much improved):-

e.g. on the following post:-
Mushroom
It is suggesting similar photos that were most recently uploaded.
The only problem with a lot of the photos that I have tagged after uploading is that, quite often 'blank and white film' photos are all that is shown in 'related photos', as they just happened to be uploaded more recently than the colour photos.
I'm not sure the best way to get round this, apart from possibly changing it so that it only shows colour photos as default. Must think about it for a while...
Probably the best thing to do is show related photos from the category the current post is in e.g. if the current post is in the 'Colour Photos' category - then show related photos from the 'Colour Photos' category etc. (Must shuffle off now to read up a bit more on how to do this type of thing on Wordpress)...
Update - rather than doing a new post - after much consulting of Wordpress and php reference materials online - here is what I have hacked together into my single.php file in order to show related photos depending on which category the current photo is in (I'm sure there is a more efficient way to do it - but it seems to work so far):-
<div style="margin-top:-10px">
<?php
//for use in the loop, list 12 post titles related to first tag on current post
$category = get_the_category();
$firstcategory = $category[0]->cat_ID;
//if first category in array is photos then take next one, needed for Sepia photos for example
if ($firstcategory==3){
$firstcategory=$category[1]->cat_ID;
}
$tags = wp_get_post_tags($post->ID);
if ($tags) {
echo '<strong>Related Photos</strong><div style="clear:both;">';
$first_tag = $tags[0]->term_id;
$args=array(
'cat' => $firstcategory,
'tag__in' => array($first_tag),
'post__not_in' => array($post->ID),
'showposts'=>12,
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div style="float:left;width:130px;height:132px;border:1px solid #d8d8d8;margin:0 3px 5px 0;padding:3px;font-size:11px;line-height:13px;"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php
//the_title();
echo yapb_get_thumbnail(
'<div>', // HTML before image tag
array(
'alt' => 'Photo thumbnail', // image tag alt attribute
'rel' => 'lightbox' // image tag rel attribute
),
'</div>', // HTML after image tag
array('w=130', 'h=130', 'q=90'), // phpThumb configuration parameters
'thumbnail' // image tag custom css class
);
?>
</a></div>
<?php
endwhile;
}
}
?>
</div>
<div style="clear:both;">
And my related posts section now looks like this (much improved):-
