WordPress.org

Ready to get started?Download WordPress

Forums

Fatal error: Cannot redeclare __popular_posts() (3 posts)

  1. Guido
    Member
    Posted 2 years ago #

    Hi,

    When I change my theme I'm getting this error:

    Fatal error: Cannot redeclare __popular_posts() (previously declared in MY WEBSITE URL \wp-content\themes\twentyeleven\functions.php:791) in MY WEBSITE URL\wp-content\themes\twentyeleven\functions.php on line 1032

    I've read some info about how to solve this, but who can tell me WHY this error appears?

    One solution is to remove all lines about popular_posts in file functions.php, but what is the purpose of that code in the first place? Display posts with most responses in the sidebar I guess?

    And when I remove all lines about popular posts from that file, activate theme, put all lines back into that file, the error appears again. This happens with all my themes, so I think somethings wrong in core WordPress files?

    Guido

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    Twenty Eleven functions.php has only about 600 lines of code by default;

    you possibly have edited the theme and added this __popular_posts() function or some code containing this function more than once.

    if you are sure that you haven't edited Twenty Eleven, replace it with a fresh copy, for instance from http://wordpress.org/extend/themes/twentyeleven

    if you have edited the theme, you could paste the full code of functions.php of your edited Twenty Eleven into a http://pastebin.com/ and post the link to it here - howto: http://codex.wordpress.org/Forum_Welcome#Posting_Code

    someone might have a look at the code ...

  3. Guido
    Member
    Posted 2 years ago #

    Thank you for your response.

    This error occurs since I've changed a specific theme from website TemplatePanic.com into another one. Now I'm getting this error every time I'm changing theme! So the problem is not Twenty Eleven theme (I think).

    This happened before with a template from TemplatePanic.com so I'm afraid something in that code caused a serious problem which stays even when I'm changing theme...

Topic Closed

This topic has been closed to new replies.

About this Topic