WordPress.org

Ready to get started?Download WordPress

Forums

Combining two functions.php? (5 posts)

  1. jlipton
    Member
    Posted 3 years ago #

    So I'm working on a portfolio theme and in the process learning WordPress. I began using Artisteer, but found it limiting. What I have now is my basic Artisteer template and I'm trying to add elements of Paul Bennett's free Viewport theme (http://paulicio.us/items/view/28/viewport-a-free-wordpress-theme) and everything's fine except for the functions.php. I need elements of both functions.php files but I don't know enough to dissect and reform the file. Whenever I add any element of the Viewport functions.php file I get this error message: "Parse error: syntax error, unexpected $end /.../functions.php on line 596"

    Can anyone help me see the problem? Both files work fine separately, and though it seems like a problem in the Artisteer functions.php, it works until I edit it.

    Viewport functions.php

    [code moderated - please follow http://codex.wordpress.org/Forum_Welcome#Posting_Code for posting code]

    Help!

  2. peredur
    Member
    Posted 3 years ago #

    Does this help:

    http://wordpress.org/support/topic/parse-error-syntax-error-unexpected-end-in-functionphp-please-help?replies=3

    Basically, just get rid of any closing ?> tag you may have in the file.

    If I understand things correctly you should, in functions.php, have just one opening <?php tag, and no closing tag.

    Cheers

    PAE

  3. jlipton
    Member
    Posted 3 years ago #

    Good thought, thank you! but no, that doesn't seem to be it. Even when there are no spaces at the end of the .php file nor closing tag I get the same error.

    I realize I messed up the format, here are the two codes again:

    Viewport functions.php : http://pastebin.com/dLubVXnY

    Artisteer functions.php : http://pastebin.com/kUx33fms

    They are long codes but I'm sure it's a simple matter I'm just too inexperienced to sort out. If anyone knows functions.php files and could take a look I would be so grateful

  4. peredur
    Member
    Posted 3 years ago #

    How are you setting about doing this. Are you, for example, copying a function from the Viewport functions.php file and pasting it into the Artiseer functions.php file?

    I assume from what you say that the Artiseer theme is your active theme.

    If that's the case, what happens if you add a dummy function to the Artiseer functions.php file just before the end. Something like:

    function my_dummy_func() {
    // Does nothing
    }

    Obviously it should be before the file's closing ?> if it has one.

    Do you get the same error? I'm trying to see if the problem occurs when something particular is added or when anything at all is added.

    Oh! And it just occurs to me to ask... When does the error occur? Does it occur when the functions.php file is loaded or when the function you're adding gets called?

    Cheers

    PAE

  5. peredur
    Member
    Posted 3 years ago #

    Hi,

    I've done some more research and I can't find a single instance where this problem is caused by anything other than a superfuous ?> tag. That's not surprising, because it's exactly what the error message says.

    I suggest you get rid of any final closing ?> tag and then paste in the code you want on a function-by-function basis, at the end of the file, testing after each paste operation until you find the code that's causing the trouble.

    You can then examine that code to find the extraneous tag.

    HTH

    PAE

Topic Closed

This topic has been closed to new replies.

About this Topic