WordPress.org

Support

Support » Themes and Templates » Strange Behaviour: Get the posts of a certain category, inside a page

Strange Behaviour: Get the posts of a certain category, inside a page

  • Hi …

    To get the articles of a certain category inside a page, I always used this code:

    <?php
    /*
    Template Name: Template_News
    */
    
    // Which page of the blog are we on?
    $paged = get_query_var('paged');
    
    // Set the category whom to fetch the posts
    query_posts('cat=3&paged='.$paged);
    
    // make posts print only the first part with a link to rest of the post.
    global $more;
    $more = 0;
    
    //load index to show blog
    load_template(TEMPLATEPATH . '/index.php');
    ?>

    But now it’s not working anymore.

    Can someone help me?
    It’s a very common problem, I just want to obtain some articles in a page.
    How do I do that?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I assume your Loop is in the included file? And exactly what isn’t working? What behavior do you see?

    WordPress seems to crash without giving any textual output (blank page).
    No errors in the php log file.

    The included file is the common-like index.php with loop and everything else.

    What can I do to put easily and without redundant code the post of a category in a page?

    Does it fail if you comment out the load_template line?

    The crash is on query_posts

    I tryed also with:
    <?php query_posts(array(‘cat’=>1,’paged’=>$paged)); ?>

    Not sure what to tell you. I’ve been testing your code and it works for me without a hitch. There must be something odd about your setup. Possibly a table is corrupt. I’d start commenting stuff until I find the problem line, then start var_dumping things. Sorry.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Strange Behaviour: Get the posts of a certain category, inside a page’ is closed to new replies.
Skip to toolbar