Merlin
Expert Member
Hi,
I've got a Wordpress installation that shows a listing of items for sale on the front page (images and excerpts).
When an item is sold, I move the article from whatever category it was in to the 'Sold' category. It still displays, but is now listed as an unavailable item.
I'd like to have the Sold items on the front page show up in a different colour and with a strike-through title. I've created CSS code for this and have tested it.
No matter what I try though, I can't get it to work with PHP.
How can I get Wordpress to check if the post title it is loading is listed in the 'Sold' category, please?
Below, in red, is the closest I've come, so far.
Thanks.
I've got a Wordpress installation that shows a listing of items for sale on the front page (images and excerpts).
When an item is sold, I move the article from whatever category it was in to the 'Sold' category. It still displays, but is now listed as an unavailable item.
I'd like to have the Sold items on the front page show up in a different colour and with a strike-through title. I've created CSS code for this and have tested it.
No matter what I try though, I can't get it to work with PHP.
How can I get Wordpress to check if the post title it is loading is listed in the 'Sold' category, please?
Below, in red, is the closest I've come, so far.
Code:
<ul class="mcol">
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<li class="article">
<?php
if ( has_post_thumbnail() ) { ?>
<?php
$imgsrcparam = array(
'alt' => trim(strip_tags( $post->post_excerpt )),
'title' => trim(strip_tags( $post->post_title )),
);
$thumbID = get_the_post_thumbnail( $post->ID, 'background', $imgsrcparam ); ?>
<div><a href="<?php the_permalink() ?>" class="preview"><?php echo "$thumbID"; ?></a></div>
<?php } ?>
<h2[color=red]<?php if (is_category(1) || is_category(4) ) { echo ' class="Sold"'; } ?>[/color]><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<div class="postmetadata">
Posted: <?php the_time(__('F jS, Y', 'kubrick')) ?> ˑ
<?php comments_popup_link(__('No Comments'), __('1 Comment'), __('% Comments'), '', __('Comments Closed') ); ?><?php edit_post_link(__('Edit'), ' ˑ ', ''); ?><br />
<?php printf(__('Filed under: %s'), get_the_category_list(', ')); ?>
</div>
</li>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
</ul>
Thanks.