Forums

[resolved] I tried a PHP code in a Text widget now all sidebar widgets are gone! (3 posts)

  1. mekaeel
    Member
    Posted 1 year ago #

    ok so I was trying to add the following code in a text widget:

    <?php
    $result = $wpdb->get_results("SELECT comment_count,ID,post_title, post_date FROM $wpdb->posts WHERE post_date BETWEEN '2009-06-01' AND '2009-07-01' ORDER BY comment_count DESC LIMIT 0 , 10");
    foreach ($result as $topten) {
    $postid = $topten->ID;
    $title = $topten->post_title;
    $commentcount = $topten->comment_count;
    if ($commentcount != 0) {
    ?>
    
    "><?php echo $title ?>
    <?php }
    }
    ?>

    afterwards all my widgets disappeared along with my footer.

    I can see the widgets in my Admin Control Panel just fine but they are not showing on the site. I tried removing/adding them again but no good.

    I tried changing themes and widgets DO show up in other themes but not in my main one, I checked the theme files and there doesn't seem to be anything wrong in any part in sidebar.php or index.php, where else should I check?

    any ideas?

    in case you need my site it's: http://www.kumailplus.com

  2. iridiax
    Member
    Posted 1 year ago #

    Here's the error on your site:

    Parse error: syntax error, unexpected '}' in /home/content/k/u/m/kumailplus/html/wp-content/themes/headlines/headlines/includes/comments.php on line 32

    Get rid of the problem text widget and try replacing your theme's comments.php mentioned above with a fresh copy.

  3. mekaeel
    Member
    Posted 1 year ago #

    worked like a charm :) thank you so much!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags