• Hi, I have downloaded the Feast theme from ThemeForest.net which includes a Facebook page and I have had to develop an app for on Facebook. Something is wrong with Facebook and WordPress. This is the errors I am getting….

    Facebook: Fatal error: Cannot redeclare class FacebookApiException in /home4/iconicb1/public_html/wp-content/themes/feast/facebook.php on line 107

    Feast theme: Fatal error: Cannot redeclare class FacebookApiException in /home4/iconicb1/public_html/wp-content/themes/feast/facebook.php on line 107

    Does anyone know what this is and can you help me solve it. Much appreciated.

    Morrison
    my email is [signature redacted]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Without seeing the code, it is a little difficult to troubleshoot, but for instance, if line 107 is an include file which has the same class, then you could do something like this:

    if (!class_exists('FacebookApiException')) {
    	include_once('whateverfile.php');
    }

    This will keep it from declaring more than once.

    Thread Starter wallace morrison

    (@wallace-morrison)

    Hi parkerj,
    Thanks for the reply.

    Here is code from my ‘Facebook PHP’ area in editor. It’s really baffling to me as to what the problem is. I want to kick it. The coding below starts at line 96 and show { at line 107

    * To make debugging easier.
    *
    * @returns String the string representation of the error
    */
    public function __toString() {
    $str = $this->getType() . ‘: ‘;
    if ($this->code != 0) {
    $str .= $this->code . ‘: ‘;
    }
    return $str . $this->message;
    }
    }

    /**
    * Provides access to the Facebook Platform.
    *
    * @author Naitik Shah <[email protected]>
    */

    Find the lines of the original code that I pasted here: https://pastebin.com/rTNUwRnZ

    Delete the original lines and then paste in the new code from pastebin and let me know if that fixes your issue.

    Thread Starter wallace morrison

    (@wallace-morrison)

    didn’t fix the issue. I get this now.

    Fatal error: Cannot redeclare class FacebookApiException in /home4/iconicb1/public_html/wp-content/themes/feast/facebook.php on line 101

    here is the code to what I have now
    line starts at 94

    public function __toString() {
    $str = $this->getType() . ‘: ‘;
    if ($this->code != 0) {
    $str .= $this->code . ‘: ‘;
    }
    return $str . $this->message;
    }
    }

    /**
    * Provides access to the Facebook Platform.
    *
    * @author Naitik Shah <[email protected]>
    */
    class Facebook

    Thread Starter wallace morrison

    (@wallace-morrison)

    parker,
    What I am trying to do is get this ‘Feast’ theme from https://themeforest.net/item/feast-facebook-fanpage-wordpress-theme/461906
    to work with my Facebook page. It’s asking for me to develop an application but I am getting those errors. Is there any other information that I can give you to assist more?

    I actually edited the code from the first time I posted, so it is located at the new pastebin url above. Did you copy form the url above or did you copy the code from the old url?

    Thread Starter wallace morrison

    (@wallace-morrison)

    crud, I used the first code and didn’t use the code below. I saved the code I had in notepad. Do I need to replace my original code and use the edited code you sent, or can I use what I have now and also use the edited code?

    You can still use the same facebook file and just overwrite that particular section with the code from pastebin.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘I'm getting errors and I don't know why’ is closed to new replies.