Skip to:
Content
Pages
Categories
Search
Top
Bottom

Displaying Posts from a Certain category

  • Profile photo of ciwankurd
    ciwankurd
    Member

    @ciwankurd

    Hi guys

    Can someone PLEASE tell me what PHP code I would use to display posts only from a certain category ?

    For example I only want posts where category ID = 3 !

    I would greatly appreciate any help.

    Thank You.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Profile photo of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    Find this:
    <?php while (have_posts()) : the_post(); ?>

    Then put this right above and change the cat name to the cat you want shown:
    <?php query_posts('&category_name=featured&showposts=10'); ?>

    Profile photo of Hugo
    Hugo
    Moderator

    @hnla

    And for future reference please check the WordPress Codex pages as they explain how to do this sort of thing very clearly with examples, it isn’t actually a BP issue and therefore not best addressed as a support post here.

    Profile photo of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    To add to what @hnla stated, if it’s about anything you can do before you add BP plugin then try searching on https://codex.wordpress.org/ or just google your question. There is more info out there about WP than you could read in a month.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Displaying Posts from a Certain category’ is closed to new replies.
Skip to toolbar