query_posts('posts_per_page=5&offset=1');'offset' => '4',
'&offset=' . $atts['offset'] );[catlist ID=1 numberposts=5 excerpt=yes date=yes offset=4]function catlist_func($atts, $content=null) {
$atts=shortcode_atts(array(
'id' => '0',
'name' => 'default',
'orderby' => 'date',
'order' => 'desc',
'offset' => '4', //Permite especificar un offset para comensar a listar los posts, contribucion por Levi Vasquez
'numberposts' => '5',
'date' => 'no',
'author' => 'no',
'dateformat' => get_option('date_format'), //By Verex
'template' => 'default',
'excerpt' => 'no',
'exclude' => '0'
), $atts);
return list_category_posts($atts);
}
add_shortcode('catlist', 'catlist_func');
function list_category_posts($atts){
if($atts['name']!='default' && $atts['id']!='0'){
$category = 'category_name=' . $atts['name'];
}else{
$category = 'cat=' . $atts['id'];
}
//Build the query for get_posts()
$catposts = get_posts($category.'&numberposts=' . $atts['numberposts'] .
'&orderby=' . $atts['orderby'] .
'&order=' . $atts['order'] .
'&offset=' . $atts['offset'] ); //Permite especificar un offset para comensar a listar los posts, contribucion por Levi Vasquez
$catposts = __($catposts); //Build the query for get_posts()
$catposts = get_posts($category.'&numberposts=' . $atts['numberposts'] .
'&orderby=' . $atts['orderby'] .
'&order=' . $atts['order']);
$catposts = __($catposts); 48 if($atts['name']!='default' && $atts['id']!='0'){
49 $category = 'category_name=' . $atts['name'];
50 }else{
51 $category = 'cat=' . $atts['id'];
52 }$category = 'cat=' . $atts['id']; The result is that you see all posts listed from all a categories.$atts['id']!='0' to $atts['id']=='0' (change from "not equal" to "equal"), so the whole line is: 48 if($atts['name']!='default' && $atts['id']=='0'){<?php query_posts('cat=30&showposts=5'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark">
<?php
$food_img = get_post_meta($post->ID, "food_img", true);
if ($food_img != "")
{
$food_img = explode(",", $food_img);
foreach ($food_img as $picture)
{
echo "<img alt=\""; the_title(); echo"\" src='" . $picture . "' />";
}
}
?>
</a>
<?php the_time('F j, Y'); ?>
| <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
</a>
<?php endwhile; else : ?>
<?php endif; ?><?php
$food_img = get_post_meta($post->ID, "food_img", true);
if ($food_img != "")
{
$food_img = explode(",", $food_img);
foreach ($food_img as $picture)
{
echo "<img alt=\""; the_title(); echo"\" src='" . $picture . "' />";
}
}
?><img title=\""; the_title(); echo"\" src='" . $picture . "' />$food_img = get_post_meta($post->ID, "food_img", true);
if ($food_img != "")
{
$food_img = explode(",", $food_img);
foreach ($food_img as $picture)alfirin said:Hi!
For everyone using Qtranslate in their websites, here is a way to make List Category Posts Plugin with multilingual support to show the correct part of the post title in each language version.
In [b]list_cat_posts.php[/b] add this line
[code]$catposts = __($catposts);[/code]
at the end of
[code] //Build the query for get_posts()
$catposts = get_posts($category.'&numberposts=' . $atts['numberposts'] .
'&orderby=' . $atts['orderby'] .
'&order=' . $atts['order']);
$catposts = __($catposts);[/code]
It works perfect for me. Thanks for this great plugin!
Cheers,
Milena from Hubavo - Interaction Design Studio
http://hubavo.com
It looks like you're new here. If you want to get involved, click one of these buttons!