• 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 (https://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 https://codex.www.ads-software.com/Forum_Welcome#Posting_Code for posting code]

    Help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Does this help:

    https://www.ads-software.com/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

    Thread Starter jlipton

    (@jlipton)

    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 : https://pastebin.com/dLubVXnY

    Artisteer functions.php : https://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

    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

    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Combining two functions.php?’ is closed to new replies.