Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter marijan_e

    (@marijan_e)

    Ok we can now say it works but, it only diplay the latest post from choosen category

    Thread Starter marijan_e

    (@marijan_e)

    Well i edited now like this

    <?php get_header(); ?>
    
    	<!-- BEGIN content -->
    	<div id="content">
    
    		<?php query_posts('showposts=1&amp;cat=9');
    if(have_posts()) : while(have_posts()) : the_post(); ?>
    
    		<!-- begin post -->
    		<div class="post">
    
    		<div class="thumb"><a href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a></div>
    		<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    		<p><?php echo dp_clean($post->post_content, 300); ?></p>
    		<a href="<?php the_permalink(); ?>" class="readmore">Read More</a>
    		</div>
    		<!-- end post -->
    
    		<?pgp endwhile; endif; ?>
    
    	</div>
    	<!-- END content -->
    
    <?php get_sidebar(); get_footer(); ?>

    and i get

    Parse error: syntax error, unexpected T_ENDWHILE in /home/www/web4437/html/wp-content/themes/meganews/index.php on line 19

    Thread Starter marijan_e

    (@marijan_e)

    I really do not know PHP

    Here is whole code for index page

    <?php get_header(); ?>
    
    	<!-- BEGIN content -->
    	<div id="content">
    
    		<?php
    		$categories = get_categories('hide_empty=1');
    		foreach ($categories as $category) :
    		query_posts('showposts=1&amp;cat='.$category->cat_ID);
    		if (have_posts()) : the_post();
    		?>
    
    		<!-- begin post -->
    		<div class="post">
    
    		<div class="thumb"><a href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a></div>
    		<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    		<p><?php echo dp_clean($post->post_content, 300); ?></p>
    		<a href="<?php the_permalink(); ?>" class="readmore">Read More</a>
    		</div>
    		<!-- end post -->
    
    		<?php endif; endforeach; ?>
    
    	</div>
    	<!-- END content -->
    
    <?php get_sidebar(); get_footer(); ?>

    Can you please update the code for me ?

    Thread Starter marijan_e

    (@marijan_e)

    So if i undestod you well

    code should look like this

    $categories = get_categories('hide_empty=1');
    		foreach ($categories as $category) :
    		query_posts('showposts=10&amp;cat=9');
    if(have_posts()) : the_post();
    		?>

    Right?

    anyway i done it like this and, what i get is that last post is shown repeatedly, because main index is coded to display latest post from all categories,

Viewing 4 replies - 1 through 4 (of 4 total)