Working on this site right now and we've got a little problem. It's a "magazine" template wordpress site. You can see here:
marbellas.com
The problem is we have a category called "Marbellas Blog". This category is already displayed in it's own box above the normal blog flow.
When we make a post to this category, the post appears twice: once in the allocated box and once in the normal blog flow.
How can I exclude this category from the front page yet stop it disappearing from this box?
The blog's allocated box code is:
Code:
<?php
//here we are going to extract the last blog post from the category called "X"
//we will also get a thumbnail for the post in case there is one
if (is_home()) {
//define the category you want to get from the blog and how many posts
$CategoryID="226";
$TotalPosts="1";
$recent = new WP_Query();
$recent->query('cat="'.$CategoryID.'"&showposts="'.$TotalPosts.'"');
while($recent->have_posts()) : $recent->the_post();
//get the permalink url for the lin to the post
$permalink = get_permalink($post->ID);
//define the header box first with the title and set up the divs for the display
echo "<div class='box'>";
echo "<h2 style='font-weight:bold; font-size:14px;'>Latest Marbellas Blog Post</h2>";
echo "<div class='block'>";
echo "<img src='http://www.marbellas.com/images/Ms_icon_blo000.jpg' />";
echo "<blockquote>";
//now get the thumbnail and post content
if (has_post_thumbnail()) {
// the current post has a thumbnail
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 120,120 ), false, '' );
echo "<div id='post-with-thumb'>";
// echo "<img src='/wp-content/themes/massivenews/thumb.php?src=".$thumb[0]."&w=120&h=120&zc=1&q=90'/>";
echo the_content_limit(480, "");
echo "<p></p>";
echo "<a href=".$permalink." >Read More About It Here</a>";
echo "</div>";
} else {
//or get the first image from the post
$thumb = get_first_image();
echo "<div id='post-with-thumb'>";
// echo "<img src='/wp-content/themes/massivenews/thumb.php?src=".$thumb."&w=120&h=120&zc=1&q=90'/>";
echo the_content_limit(480, "");
echo "<p></p>";
echo "<a href=".$permalink." >Read More About It Here</a>";
echo "</div>";
}
echo "</blockquote>";
echo "</div>";
echo "</div>";
endwhile;
}
And then the posts begin, this is where I need to exclude the blog post category from.
Code:
<div class="block">
<div class="article first_main_article">
<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a></h1>
<div class="meta"> <span class="time">
<?php //the_time('F j, Y'); ?>
</span> <span class="categories">
<?php the_category(', ') ?>
</span> <span class="discuss">
<?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?>
</span>
<?php if (is_user_logged_in()) : ?>
<span class="editlink">
<?php edit_post_link('Edit This Post', '', ''); ?>
</span>
<?php endif; ?>
</div>
<?php
//######################################################################
//here we will get the thunmbail for the post
if (has_post_thumbnail()) {
// the current post has a thumbnail
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 120,120 ), false, '' );
echo "<div id='post-with-thumb'>";
echo "<img src='/wp-content/themes/massivenews/thumb.php?src=".$thumb[0]."&w=120&h=120&zc=1&q=90'/>";
echo the_content_limit(470, "");
echo "</div>";
} else {
//get the first image from the post
$thumb = get_first_image();
echo "<div id='post-with-thumb'>";
echo "<img src='/wp-content/themes/massivenews/thumb.php?src=".$thumb."&w=120&h=120&zc=1&q=90'/>";
echo the_content_limit(480, "");
echo "</div>";
//echo $thumb;
}
//######################################################################
?>