WordPress.org

Ready to get started?Download WordPress

Forums

How to have page call in specific blog posts?? (10 posts)

  1. mixmastermichael
    Member
    Posted 2 years ago #

    Hi friends,

    so I have a site that needs to pull in just specific blog category, the "press" section.

    Is there a way to have the page query the posts to come in only in the press section??
    http://www.moko.com.php5-21.websitetestlink.com/?page_id=14

    ^ as you can see, I've got it working now... but I need it so that the twitter / facebook stuff comes in, which just won't work using the method I have now.

    I tried looking here, and got the query to pull in the posts, but it pulls in ALL posts from the blog, not just one category like I would like.
    http://codex.wordpress.org/Function_Reference/query_posts

    Pretty desperate and running out of ideas here. Any help would be GREATLY appreciated!

  2. Peter Butler
    Member
    Posted 2 years ago #

    If I'm understanding the problem right, what you're looking for is here:

    http://codex.wordpress.org/Function_Reference/query_posts#All_Posts_in_a_Category

    You just need to specify the 'category_name' parameter. You can also use the 'cat' parameter if you'd rather use the category id - check out example 4 on that page.

  3. mixmastermichael
    Member
    Posted 2 years ago #

    Hell ya, example 4 worked. Just changed the category to the right one and it works great.

    Thanks a lot for the reply man. Really made my night!

  4. mixmastermichael
    Member
    Posted 2 years ago #

    Okay, update, so I got the posts to show up in the Press section, but I need to have it so that the posts also include the author, ability to comment, etc.
    http://www.moko.com.php5-21.websitetestlink.com/?page_id=14

    The "blog" section with all the posts looks the way it should, I just need the same functionality on the "press" page above.
    http://www.moko.com.php5-21.websitetestlink.com/?page_id=217

    I am currently using the following code to bring in the posts from the press category, is it possible to also include other things to bring in so that it woks the way it should? such as author, comments, etc?

    <?php
    $args = array(
    'cat' => 6,
    );
    query_posts( $args );
    ?>

  5. mixmastermichael
    Member
    Posted 2 years ago #

    Lil help? Just need to know what the array field for author, comment, etc I think. If I put those in the array like I did for 'cat' - it should work, right?

  6. Peter Butler
    Member
    Posted 2 years ago #

    I'm pretty sure all the fields should be brought in every time so if those fields arent showing up where you expect them to, I would look at your the tmplate page for "Press", do make sure it's trying to display teh author and stuff (it should really be basically a duplicate of whatever page is controlling the "blog" page - probably index.php? or maybe archive.php?).

    If those match, and you're still not seeing what you're after, I guess maybe we'd want to check ot make sure that the loop is being set up properly. That's a little trickier (and by that, I mean: I don't know it right off the top of my head).

  7. mixmastermichael
    Member
    Posted 2 years ago #

    hmm... weak. Might you know where I can normally find this "loop"?

    I've dealt with it in the past, but it was in a different location I think... can't quite remember. There's no loop.php file or anything. I would imagine it's in the index.php file, but I don't really know what to look for.

    After this code is placed in my press template, everything else seems to get ignored, is that normal?

    <?php
    $args = array(
    'cat' => 6,
    );
    query_posts( $args );
    ?>

  8. Peter Butler
    Member
    Posted 2 years ago #

    It's tough to say without seeing hte code. Can you put the code for the press page on pastebin.com or somewhere? With that, I bet we could get it sorted out.

  9. mixmastermichael
    Member
    Posted 2 years ago #

    um, ya, so here's the index.php file where it would make most sense that the loop would be....
    http://pastebin.com/eMaBv7rS

    for what it's worth, here's the press template file...
    http://pastebin.com/zvH6PNaZ

    and the functions.php file...
    http://pastebin.com/SzgWPVhN

    Thanks so much for your help man, you have no idea how much it means to me.

  10. mixmastermichael
    Member
    Posted 2 years ago #

    bumpy?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.