Change Loop

Discussion in 'Compass WordPress Theme' started by floopie, Jun 13, 2015.

  1. floopie

    floopie New Member

    Joined:
    Jun 8, 2015
    Messages:
    9
    Likes Received:
    0
    Hi Guys,

    i´ve tried to figure out how i can change the excisting php struktur, to get only posts from a specific category. The Code used in your theme as follow:

    PHP:
     <?php
        $limit 
    5;
        
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        
    query_posts('showposts=' $limit '&paged=' $paged);
        
    $wp_query->is_archive true;
        
    $wp_query->is_home false;
        
    get_template_part('loop''blog');
    ?>
    Now i have to change this, to get only posts from category with ID 50. Can u tell me please, how to change the above code?

    Thanks
     
  2. Sobhagya

    Sobhagya Guest

    Joined:
    May 29, 2015
    Messages:
    414
    Likes Received:
    6
    Hello,

    Kindly specify where you want to change structure to show blog post from specific category.

    Is front page or blog page..?

    Let me know.
     
  3. floopie

    floopie New Member

    Joined:
    Jun 8, 2015
    Messages:
    9
    Likes Received:
    0
    Hi,
    i want to use this Loop in a single page. Have a look at this page: http://floopie.de/ark-survival-evolved/ at the end there is the changed Loop. It show up the special content from just a selected Category. So problem already solved.

    PHP:
    <?php
        $limit 
    5;
        
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        
    query_posts('showposts=' $limit '&paged=' $paged '&cat=50');
        
    $wp_query->is_archive true;
        
    $wp_query->is_home false;
        
    get_template_part('loop''blog');
    ?>
     
  4. floopie

    floopie New Member

    Joined:
    Jun 8, 2015
    Messages:
    9
    Likes Received:
    0
    Sry, guess it doenst work. Is there an idea?
     

Share This Page