• Resolved burakb

    (@burakb)


    Hello,

    I would like to display posts from a specific category on a custom page I have designed.

    I have tried several codes but none of them work well.

    If someone can suggest me a working one I would really appreciate.

    I would like to display posts from a specific category between a div tag.

    I tried to use this one but does not work;

    <div style="clear:both;">
     <ul>
     <?php
     global $post;
     $myposts = get_posts('numberposts=5&offset=1&category=3');
     foreach($myposts as $post) :
     setup_postdata($post);
     ?>
     <li><a href="<?php echo get_permalink($postid); ?>" title="<?php the_title(); ?>"></a></li>
     <?php endforeach; ?>
     </ul></div>
Viewing 2 replies - 1 through 2 (of 2 total)
  • I think you just need to display the title for the text of the links:

    <li><a href="<?php echo get_permalink($postid); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>

    Thread Starter burakb

    (@burakb)

    thank you very much vtxyzzy.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to display posts from a specific category on a custom page.’ is closed to new replies.