SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Location
    USA
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Blocking Certain Category From Recent Posts

    I use
    PHP Code:
    <?php $myposts get_posts('numberposts=10&offset=0');foreach($myposts as $post) :?>
    to call the recent posts in my blog, but I would like to block posts from certain categories, one in particular - workout_music

    Can the PHP tag be written to exclude recent posts in a category?

  2. #2
    SitePoint Guru
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have two options

    You filter the result set from the moment you get them out from database

    Or you can use php array do something like this

    Code PHP:
    while ($subcat_rows = mysql_fetch_assoc($subcat_result))
    {
    	$groups[$subcat_rows['abbreviation2']][] = $subcat_rows;
    }

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Location
    USA
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by runrunforest View Post
    You have two options

    You filter the result set from the moment you get them out from database

    Or you can use php array do something like this

    Code PHP:
    while ($subcat_rows = mysql_fetch_assoc($subcat_result))
    {
    	$groups[$subcat_rows['abbreviation2']][] = $subcat_rows;
    }
    Ugggg my friend you have given me what I am sure is a very logical and well thought out reply, but I am confessing to being lost.

    Would I use this in PLACE of my php code, or combine your string with it somehow? I apologize, but this is not an area of strength for me.

    Might you be able to show me what I should insert into my template in place of the string I am currently using?

  4. #4
    SitePoint Guru
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you show your query and table structure? so we can help further.

  5. #5
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Location
    USA
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by runrunforest View Post
    can you show your query and table structure? so we can help further.
    I attached a screen shot of my structure and query. DOes this help?
    Attached Images Attached Images


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •