Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Oct 2007
    Posts
    241
    Member #
    15910
    Hello,
    In wordpress is it possible to display news form each category separately on home page? I mean on separate locations and with different sizes or news quantities etc... So I want every category to have different area. Is that doable? How? Or does it depend on the theme?

  2.  

  3. #2
    Senior Member diddy's Avatar
    Join Date
    Jun 2008
    Location
    Sydney, Australia
    Posts
    502
    Member #
    16955
    I don't think you're being very clear.

    On most themes, you can insert the 'categories' widget. It's a drop-down box that appears on the sidebar. To show posts from a certain category, just click on the category and you have every post from that category shown.

    Sorry if I misenterpreted your quesiton. Could you make it a bit more clearer?

  4. #3
    Senior Member Danny[MLWA]'s Avatar
    Join Date
    Jun 2009
    Location
    Goldsboro, North Carolina, USA
    Posts
    109
    Member #
    19147
    Liked
    5 times
    Hes talking about looping out a news category, then a portfolio category, etc on the same page -- yes it is possible just create multiple query_posts('cat=3'); and while(have_posts())
    Lead Web Designer
    MLW & Associates, LLP.
    W3C Standards Complaint and SEO Friendly
    Admin of Vraul
    WordPress.org Developer

  5. #4
    Senior Member
    Join Date
    Dec 2009
    Location
    Chicago, IL
    Posts
    114
    Member #
    20579
    Liked
    2 times
    Number 2 in this article will get you pretty close:

    http://www.smashingmagazine.com/2009...ss-loop-hacks/

  6. #5
    Senior Member Danny[MLWA]'s Avatar
    Join Date
    Jun 2009
    Location
    Goldsboro, North Carolina, USA
    Posts
    109
    Member #
    19147
    Liked
    5 times
    Whom ever wrote that article gets little respect form me as a developer.

    the loop is what allows you to get posts from your WordPress database and print them on the screen
    That is false. The actual "the_content" contains the echo command that is responsible for printing the info from the database to the page. Secondly a loop is NOT required to display anything except for assorted information. Simply querying one signle record from the database does NOT require a loop.

    So you can better understand, a loop runs through an array (list of records), and carries out actions per record individually in the same function. For instance:
    Code:
    for ($i=0;$i<100;$i++)
       {
       // This is inside the loop
       echo($i); // will count up from 0 to 99.
       }
    // This is outside the loop
    That is a loop. If had a query as "$i" and needed to loop that out, the data structure would look something like this:
    postID | the_title | perma_link | the_content
    1 | Greatness In loops | greatness-in-loops | And a bunch of stuff here
    2 | Something Else | something-else | and something else here too.

    If I only wanted to query row 1, I would simply query it with something like:
    Code:
    $query = mysql_fetch_array(mysql_query("SELECT * FROM `some_table` WHERE `postID`='1'"));
    echo('This is the content: ' . $query['the_content']);
    Would print the record needed without any loops at all.
    If, I wanted to list both records, now there is where the loop is required.

    To break it down, a loop is only required under 1 condition; there are multiple records you are querying. There are only a few conditions in the WordPress blog where this is used:
    * Home page (where news is listed)
    * Categorys page
    * Archives page
    * and some widgets

    Regular pages, posts, etc do NOT have any loopage at all =)
    Lead Web Designer
    MLW & Associates, LLP.
    W3C Standards Complaint and SEO Friendly
    Admin of Vraul
    WordPress.org Developer

  7. #6
    Senior Member
    Join Date
    Dec 2009
    Location
    Chicago, IL
    Posts
    114
    Member #
    20579
    Liked
    2 times
    While I agree that the nomenclature is slightly off, when the author refers to "the loop" they are referring directly to the WordPress's terminology for outputting data. Also, they did pluralize "posts", so really it does require a loop of some sort in order to output your returned array in a structured manner.

    Keep in mind that this is a design magazine, so the language is probably intentionally simplified for the greater good of the readers.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:51 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com