Hi, vtxyzzy, thank you for response, but it’s not working for me.
I used your code and on my Home page template insted of six posts (one on the top ant five more as headlines), there’s only two. I dont know why, but those two posts arent newest ones from that category.
Here’s my template with your code:
<?php get_header(); ?>
<div id="container">
<div id="left-div">
<div id="left-inside">
<span class="sidebar_head_news"><?php _e("<!--:en-->Latest News<!--:--><!--:LT-->Naujausi prane?imai<!--:-->"); ?></span>
<div style="clear: both;"></div>
<?php // query_posts ($query_string . '&cat=5&showposts=1'); ?>
<?php // query_posts(array('category__and' => array(1,2))); query_posts ($query_string . 'showposts=1'); ?>
<?php // if (have_posts()) : while (have_posts()) : the_post();
// if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
<?php $do_not_duplicate = array(); query_posts (array('category__and' => array(5,16), 'posts_per_page' => 1)); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); $do_not_duplicate[] = $post->ID; ?>
<?php $thumb = get_post_meta($post->ID, 'Thumbnail', $single = true); ?>
<div class="panel">
<div class="featured-post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="176" style="padding:0px; margin:0px; vertical-align:top;"><div class="thumb_75"><a href="<?php the_permalink() ?>" rel="bookmark" title=" <?php the_title(); ?>"><img src="<?php if ( p75HasThumbnail($post->ID) ) { echo p75GetThumbnail($post->ID); } ; ?>" alt="" class="attachment-featured wp-post-image" /></a></div></td>
<td style="padding:0px; margin:0px; vertical-align:top;"><span class="sidebar_head_news_list">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title=" <?php the_title(); ?>"><?php the_title2('', '...', true, '100') ?></a></h2></span>
<div class="featured-post-description">
<?php //<div class="cat_link">Skiltis:
//$category = get_the_category();
//echo $category[0]->cat_name;
//</div>?>
<p><?php the_content_limit(300, "..."); ?></p>
<a style="float:right" href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php _e("<!--:en-->Read more<!--:--><!--:LT-->Skaityti<!--:-->"); ?></a>
</div> </td>
</tr>
</table>
<div style="clear: both;"></div>
</div> <!-- featured-post -->
</div> <!-- panel -->
<!-- coda-slider -->
<!--End Post Single-->
<?php endwhile; ?>
<div style="clear: both;"></div>
<div class="news_headlines"><div><ul>
<?php // $posts = get_posts('&cat=5&showposts=5&offset=1'); foreach ($posts as $post) { start_wp(); ?>
<?php $posts = get_posts(array('category__and' => array(5,16), 'posts_per_page' => 5, 'post__not_in' => $do_not_duplicate)); foreach ($posts as $post) { start_wp(); ?>
<li><em><?php the_time('Y F j'); ?></em> <a href="<?php the_permalink() ?>" rel="bookmark" title=" <?php the_title(); ?>"><?php the_title2('', '...', true, '100') ?></a></li>
<?php } ?>
<li class="last"></li>
</ul></div></div>
<div style="clear: both;"></div>
<div class="readmore_news"><a href="<?php _e("<!--:en-->naujienos/?lang=en<!--:--><!--:LT-->naujienos/<!--:-->"); ?>" rel="bookmark" title=" <?php _e("<!--:en-->More news<!--:--><!--:LT-->Daugiau naujien?<!--:-->"); ?>"><?php _e("<!--:en-->More news<!--:--><!--:LT-->Daugiau naujien?<!--:-->"); ?></a></div>
<div style="clear: both;"></div>
<hr />
<?php else : ?>
<!--If no results are found-->
<h2 ><?php _e("<!--:en-->Not Found<!--:--><!--:LT-->Paie?kos rezultatai<!--:-->"); ?></h2>
<p><?php _e("<!--:en-->Your search did not match any documents.<!--:--><!--:LT-->Jūs? u?klausa neatitiko joki? dokument?<!--:-->"); ?> </p>
<!--End if no results are found-->
<?php endif; ?>
<div class="domtab">
<ul class="domtabs">
<li><a href="#t1"><?php _e("<!--:en-->Files for Download<!--:--><!--:LT-->Bylos atsisiuntimui<!--:-->"); ?></a></li>
<li><a href="#t2"><?php _e("<!--:en-->Top Forum Topics<!--:--><!--:LT-->Naujausi Prane?imai Forume<!--:-->"); ?></a></li>
<li><a href="#t3"><?php _e("<!--:en-->Find Us On Facebook<!--:--><!--:LT-->Draugaukime Facebook'e<!--:-->"); ?></a></li>
</ul>
<div>
<a name="t1" id="t1"></a>
<div id="community">
<div id="community-title"></div>
<?php // get_attachment_icons($echo=true); ?>
<?php
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'application/zip, application/vnd.ms-excel, application/pdf, application/vnd.ms-powerpoint', //application/msword,
'posts_per_page' => -1,
'post_status' => null,
'post_parent' => null, // any parent
);
$attachments = get_posts($args);
if ($attachments) ?>
<ul> <?php
foreach ($attachments as $attachment) : ?><li> <?php
the_attachment_link($attachment->ID, false);
?></li> <?php endforeach; ?></ul>
<div style="clear: both;"></div>
</div>
<div style="clear: both;"></div>
<p><a href="#top">back to menu</a></p>
</div>
<div>
<a name="t2" id="t2"></a>
<div id="community">
<div id="community-title"></div>
<div style="clear: both;"></div>
<ul>
<?php
// fill with your db acces information
$d_bhost = '*****'; // host (localhost, 06.mysqlprovider.com)
$db_name = '*****'; // your data base name
$db_user = '*****'; // your data base user name
$db_pass = '*****'; // your data base password
$prefix = '******'; // the prefix of yours pbpbb tables (phpbb_ by default)
$dir = 'https://www.hemofilija.lt/forumas/'; // this is your foro address
$msg_display = 7; // number of displays you need
// follow my syntax for exclude your hidden or private forums...
// if you dont know how id have your hidden forums, just go to your hidden forum, check your direction bar (in your navigator, EX. firefox, explorer)
// and put atention on this: viewforum.php?f=8
// f - means forum, in this case, my hidden forum is the id - 8
$hidden_forum = "post.forum_id <> 12 AND post.forum_id <> 33 AND post.forum_id <> 36"; // the syntax: post.forum_id <> hiden-forum-id (dont forget add an AND syntax for a new condition)
// if you dont have experience on programming... dont touch this
$conn = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($db_name,$conn);
$sql = "select * from phpbb_topics order by topic_last_post_time desc limit 0,10";
$result = mysql_query($sql) or die("Service temporairly unavailable");
while ($rows = mysql_fetch_array($result)) {
$start = round($rows[topic_replies] / 10).'0';
$rows[post_text] = preg_replace("(\[.+?\])is",'',$rows[post_text]); // to exclude phpbb code
$rows[post_text] = substr($rows[post_text],0,80)."..."; // to limit to XX chars
echo "<li>";
echo '<a href="'.$dir.'viewtopic.php?f='.$rows[forum_id].'&t='.$rows[topic_id].'&start='.$start.'#p'.$rows[topic_last_post_id].'" title="'.$rows[topic_title].'" target="_blank"> '.$rows[topic_title].'</a>';
echo "</li>";
}
mysql_free_result($result);
mysql_close($conn);
?>
</ul>
</div>
<p><a href="#top">back to menu</a></p>
</div>
<div>
<a name="t3" id="t3"></a>
<div id="community">
<div id="community-title"></div>
<div style="clear: both;"></div>
<iframe src="https://www.facebook.com/plugins/likebox.php?id=127802983898265&width=618&connections=0&stream=false&header=false&height=105" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:618px; height:105px;" allowTransparency="true"></iframe>
</div>
<div style="clear: both;"></div>
<p><a href="#top">back to menu</a></p>
</div>
</div>
</div>
</div>
<!--Begin Sidebar-->
<?php get_sidebar(); ?>
<!--End Sidebar-->
<!--Begin Footer-->
<?php get_footer(); ?>
<!--End Footer-->
</body>
</html>