1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Wordpress function.

Discussion in 'PHP' started by kmelody5185, Feb 21, 2009.

  1. #1
    I have a problem with wordpress function.
    I'm using function: query_posts("showposts=20&orderby=comment_count&order=DESC");.
    Error occurred: The list of posts incorrect order.
    Who can help me?
     
    kmelody5185, Feb 21, 2009 IP
  2. crunk_monk

    crunk_monk Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't know anything about wordpress but I know the Dummies series has a book on it. You could try looking there.
     
    crunk_monk, Feb 21, 2009 IP
  3. unlimitedmoviez

    unlimitedmoviez Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    <?php $current_month = date('m'); ?>
    <?php $current_year = date('Y'); ?>

    <?php query_posts("cat=22&year=$current_year&monthnum=$current_month&order=ASC"); ?>
    try like this
     
    unlimitedmoviez, Feb 25, 2009 IP
  4. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #4
    shallowink, Feb 25, 2009 IP
  5. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yeah, could be the problem, I'll look at the database.
     
    Lpe04, Feb 25, 2009 IP
  6. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Lpe04, Feb 25, 2009 IP
  7. sampathsl

    sampathsl Guest

    Messages:
    861
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Try this out
    $posts = $wpdb->get_results("SELECT ID, post_title, comment_count FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 7");
    Then you can retrieve the post ID,post Title and count using this "$posts" variable. use it inside a for each loop.
    i.e : $id = $post->ID;
     
    sampathsl, Feb 25, 2009 IP