• Resolved chainzor

    (@chainzor)


    Alright, so yesterday I figured that I need to make my blog with a static frontpage, and a secondary site for the actual blog. However, a new problem arises: i can’t seem to put together a custom query that enables me to publish posts of a certain category to my static frontpage. I’ve had a lot of different attempts on addressing the problem, linking all the code would consume a server or two, none the less i’ve tried things like copypasta on this, but i just can’t get anything to show. : (

    What am i doing wrong here? How do i pull in to info to run The Loop on my static page, (and if you know a real smooth way to exclusevly post from a category, it’s probably sneakier than mine ?? )

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter chainzor

    (@chainzor)

    Hm, there seems to be one problem with my scripting.

    If i instanciate a fresh query:

    <?php  $featured = new WP_Query(); if ($featured->have_posts()) : while ($featured->have_posts()) : $featured->the_post(); ?>
    <?php the_title(); print("<br />"); the_content(); ?>
    <?php endwhile; else: ?>
    <p> Nothin 'ere </p>
    <?php endif; ?>

    Nothing shows.

    So, maybe there’s a parameter for the WP_Query() that I’m unaware of? Remember, the script is on a static frontpage, the loop is is on a page called ‘Blog’.

    Thread Starter chainzor

    (@chainzor)

    And i finally resolved my own problem. If anyone misses the same thing i do, here’s what i lacked:

    <?php $featured->query('cat=1'); ?>

    Apparently, WP_Query doesn’t fetch anything untill you specify more. I was unable to figure this from the codex, but an external resources saved my ass.

    Happy hacking!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Making a static frontpage with a custom query for posts.’ is closed to new replies.