WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Elan42.com
    Member
    Posted 4 years ago #

    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?

  2. s_ha_dum
    Member
    Posted 4 years ago #

    I assume your Loop is in the included file? And exactly what isn't working? What behavior do you see?

  3. Elan42.com
    Member
    Posted 4 years ago #

    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?

  4. s_ha_dum
    Member
    Posted 4 years ago #

    Does it fail if you comment out the load_template line?

  5. Elan42.com
    Member
    Posted 4 years ago #

    The crash is on query_posts

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

  6. s_ha_dum
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.