WordPress.org

Support

the_permalink

  • Hello guys!

    I’m working on a project and I really need your help on this one. The achieve on any standard wordpress site shows all posts under a date. Now what can I do if i want it to show everything for only one specific category?

    If you see my site at http://www.kreativpotens.dk u’ll notice that my theme shows a list of all post at the bottom-right. I want it to show ONLY all posts posted under this specific category http://www.kreativpotens.dk/?cat=2

    If i look in the sidebar.php this is the line i want to modify:

    <?php the_permalink() ?>”>

    I suppose the_permalink has to be changed to something else, just don’t know what to write.

    Can you help me?

Viewing 5 replies - 1 through 5 (of 5 total)
  • dannybcastillo

    @dannybcastillo

    <ul>
    <?php
    $myposts = get_posts('numberposts=5&category=1');
    foreach($myposts as $post) :
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> --- <?php the_excerpt(); ?></li>
    <?php endforeach; ?>
    </ul>

    Try this,

    dannybcastillo

    @dannybcastillo

    Thank you very much Danny!

    I forgot to say that i would like it to show only the Title of the posts, if I do it your way then it shows the whole post, which is kinda too much 😀

    What should i change to only show the title?

    dannybcastillo

    @dannybcastillo

    --- <?php the_excerpt(); ?>
    just remove this from the code above. that should only show the title.

    Thank you Danny, truly you are the man of the night!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘the_permalink’ is closed to new replies.
Skip to toolbar