Guzel magazine theme

Discussion in 'WordPress' started by Agent001, Dec 5, 2009.

  1. #1
    Since the guzel magazine theme is no longer developed and therefore official support doesn't exist, i want to ask here if someone can help me.

    On the index page, right from the featured post area there are four tabs, first of them is "popular", which lists popular posts.

    I'm curious, based by which criteria does it work - number of views or number of comments or what?

    I want it to show post with the largest amount of comments! Currently, it is showing posts with max 5 coments, and i have way more posts with more coments than that...

    How can it be solved?

    Thank you in advance,
    Agent001
     
    Last edited: Dec 5, 2009
    Agent001, Dec 5, 2009 IP
  2. grangonzo

    grangonzo Peon

    Messages:
    94
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    We all know? I didn't.

    Would it be better to switch to a theme that has official support?
     
    grangonzo, Dec 5, 2009 IP
  3. Agent001

    Agent001 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Corrected.

    It would be the best... But, at the moment, this theme suits my site the best, and until i find something that i like and think it would be good on my site, i'll use this one.
     
    Agent001, Dec 5, 2009 IP
  4. Wp-Mod.Com

    Wp-Mod.Com Peon

    Messages:
    381
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    mostly popular posts are always on total no. of comments , may be your code is showing post of a certain year that is why it is showing less,

    i use this code in my theme

    paste this in your functions.php
    <?php
     function most_popular_posts($no_posts = 5, $before = '<li>', $after = '</li>', $show_pass_post = false, $duration='') {
    global $wpdb;
    $request = "SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments";
    $request .= " WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish'";
    if(!$show_pass_post) $request .= " AND post_password =''";
    if($duration !="") { $request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";
    }
    $request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";
    $posts = $wpdb->get_results($request);
    $output = '';
    if ($posts) {
    foreach ($posts as $post) {
    $post_title = stripslashes($post->post_title);
    $comment_count = $post->comment_count;
    $permalink = get_permalink($post->ID);
    $output .= $before . '<a href="' . $permalink . '" title="' . $post_title.'">' . $post_title . '</a> (' . $comment_count.')' . $after;
    }
    } else {
    $output .= $before . "None found" . $after;
    }
    echo $output;
    }
    ?>
    Code (markup):
    and call this code where you want your popular post

    <ul><?php most_popular_posts(); ?></ul>
    Code (markup):
     
    Wp-Mod.Com, Dec 5, 2009 IP