WordPress.org

Support

Support » Plugins and Hacks » Help: list all posts in same category as current p

Help: list all posts in same category as current p

  • I’ve been struggling over this for a week, but I’m just not good enough at coding PHP to do it myself. Can anyone help me? I’d like to produce a list of all the posts in the same category as the currently displayed post. For example, if the post X is in category #1, I’d like a list of all the posts in category #1 (including post X) listed in alphabetical order by name. Just the title wrapped in a permalink.
    I’d be happy to buy someone something from their Amazon wishlist in exchange for writing the code for me!
    Apologies for cross-posting, but I am really desperate to get my site up and running, and this is the last hurdle, and I thought that maybe the Hacks forum would be a better place to try than the “tips” forum. Here is the other post if you want to see my laughable efforts at coding from scratch in PHP:
    http://wordpress.org/support/3/3495
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Two problems. #1 is this:
    SQL/DB Error:
    [You have an error in your SQL syntax near 'ORDER BY post_status DESC, post_date DESC LIMIT 30' at line 1]
    SELECT DISTINCT * FROM wp_posts WHERE (post_status = 'publish' || post_status = 'sticky') AND post_category= ORDER BY post_status DESC, post_date DESC LIMIT 30
    The number 2 problem is I’m not sure how to write the loop. I know it should look something like this, but I’m not sure how to modify it:
    $cat=posts_of_cat();
    $blog=1;
    require_once("wp-blog-header.php");
    foreach ($post as $posts) { start_wp(); //start of loop
    ?>

  • " rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?>
    <?
    } //end of loop

Oops. That was meant for the other thread. (I really wish they would use PHPBB for these forums instead of miniBB – miniBB is very difficult to use – and it difficult to read as well.)

nice…

see other post…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Help: list all posts in same category as current p’ is closed to new replies.
Skip to toolbar