The MU forums have moved to WordPress.org

Followed custom header instructions and get error code (19 posts)

  1. worldblogosphere
    Member
    Posted 16 years ago #

    Hi,

    I followed the instructions in the tutorial on how to let users custumize the header sections of their sites. I am now getting the following error code.

    Parse error: syntax error, unexpected $end in /home/blogamer/public_html/wp-content/themes/bluebird/functions.php on line 39

    Line 39 is now where the closing ?> is located.

    Any suggestions on how to fix it?

    Thanks,
    Gene

  2. Ovidiu
    Member
    Posted 16 years ago #

    what tutorial are you referring to? would be helpful to know that...

  3. worldblogosphere
    Member
    Posted 16 years ago #

  4. Ovidiu
    Member
    Posted 16 years ago #

    I suggest you psot your modified functions.php to pastebin and the link here, so we can have a look at it.

    btw. thx for the tutorial, it had escaped my attention :-)

  5. andrea_r
    Moderator
    Posted 16 years ago #

    Means you missed something. :) Most likely there's a typo or missing character.

  6. worldblogosphere
    Member
    Posted 16 years ago #

    Well, I am cutting and pasting everything. Even the theme name I need to change. So if it is a typo or missing character it can't be mine.

    Here is the error code I am getting.

    Parse error: syntax error, unexpected $end in /home/blogamer/public_html/wp-content/themes/artificialintelligence/artificialintelligence/functions.php on line 48
    ------------

    Line 48 is the closing tag ?>

    Here is the coding from functions.
    ------

    <?php
    if ( function_exists('register_sidebar') ) {
    register_sidebar( array('before_widget' => '<div class="box">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>') );
    }

    function custom_comment($comment, $args, $depth) {
    $GLOBALS['comment'] = $comment;
    ?>
    <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
    <?php echo get_avatar( get_comment_author_email(), '32' ); ?>
    <?php comment_author_link() ?> | " title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?> <?php edit_comment_link('e','',''); ?>
    <?php if ($comment->comment_approved == '0') : ?>
    Your comment is awaiting moderation.
    <?php endif; ?>

    <?php comment_text() ?>
    <small class="replycomment"><?php comment_reply_link(array('reply_text' => 'Reply to this comment', 'depth' => $depth, 'max_depth'=> $args['max_depth'])) ?></small>
    <?php
    }
    //make changeable header
    define('HEADER_TEXTCOLOR', '');
    define('HEADER_IMAGE', 'setta.jpg'); // %s is theme dir uri and image filename
    define('HEADER_IMAGE_WIDTH', 385); // make sure these values match the theme header
    define('HEADER_IMAGE_HEIGHT', 174);
    define( 'NO_HEADER_TEXT', true );

    function artificialintelligence() { // change atypxmas to your theme name
    ?>

    // this part adds the header in the admin area
    #headimg {
    height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
    width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
    }

    #headimg h1, #headimg #desc {
    display: none;}
    }

    function header_style() {
    ?>

    #header{
    background: url(<?php header_image() ?>) no-repeat;}
    }

    add_custom_image_header(’header_style’, ‘artificialintelligence’);
    ?>

  7. andrea_r
    Moderator
    Posted 16 years ago #

    Aha, it stripped out a couple of opening php tags. It's the bottm part that needs fixing.

    `
    <?php
    function header_style() {
    ?>

    #header{
    background: url(<?php header_image() ?>) no-repeat;}
    }

    <?php
    add_custom_image_header(’header_style’, ‘artificialintelligence’);
    ?> '

    that should do it.

    Also, you scraped the code off the screen. It's bound to screw up. the post included a sample file with all the right code in it.

    And you will also have ot change the line to point to the correct header image.

  8. worldblogosphere
    Member
    Posted 16 years ago #

    Thanks Andrea.

    Now the error is indeed gone, but it isn't changing the image.

    I changed the path like you said.
    Made
    '%s/setta.jpg'
    Into
    '%s/intro.jpg'

    That didn't change anything.
    So then I went and put the actual path in place of the %s/, and still nothing.
    It lets me upload an image, and then crop the image to match the size, but then does not show on the actual page.

    Any thoughts?

  9. andrea_r
    Moderator
    Posted 16 years ago #

    "I changed the path like you said.
    Made
    '%s/setta.jpg'
    Into
    '%s/intro.jpg'

    That didn't change anything."

    That's correct. When you go to the menu option, you'll see the original header for the theme. (or if you get a new one uploaded, you'll see that)

    If it's bombing past the crop stage, then it's also past the stage where it uses the code I gave you. Likely something's up server-side. Check your error logs.

  10. worldblogosphere
    Member
    Posted 16 years ago #

    Well, I wasn't totally clear in my last response.

    I meant after I put in a new image it didn't change anything.

    However, even before I uploaded a new image it DID NOT show the original image. All that shows is a blank space the size of the parameters I had put in. To me that says it isn't finding the path of the image correctly.

    The current path to the image is:
    'worldblogosphere.com/wp-content/themes/artificialintelligence/artificialintelligence/images/intro1.jpg'

    I have tried the following:
    , '%s/artificialintelligence/images/intro.jpg');

    , '%s/intro.jpg');

    and
    , 'worldblogosphere.com/wp-content/themes/artificialintelligence/artificialintelligence/images/intro.jpg');

    With all three - no result. Just the blank space the size of the parameters.

  11. andrea_r
    Moderator
    Posted 16 years ago #

    but you didn't try

    '%simages/intro.jpg');

    :)

    It may or may not need a / in front of images.

  12. worldblogosphere
    Member
    Posted 16 years ago #

    Well we are making progress.

    After making it '%s/images/intro.jpg' it now shows the image when i click Custom image Header. However when I change the image it still doesn't show up on the actual page (it does show on the custom image header page).

    I checked the error log and the last entry was from when I was trying to figure out the right link to put in. It is saying that the image didnt exist because at the time it was the incorrect path. After that though it shows no errors.

    Any other thoughts on what it could be on the server side? Since now it seems like it is as you said, past the point of what the code is supposed to do.

  13. Ovidiu
    Member
    Posted 16 years ago #

    disabled/cleared caching? serverside as well as in the browser if you used the same image name it will still be in the browser cache...

    btw.

    - what exactly does this option do:

    define( 'NO_HEADER_TEXT', true );

    - where can I read more about this? I mean where do the uploaded images go?

    - whats the thing with that comment:
    if ‘blank’ check so that the words can be hidden when you click hide text

  14. andrea_r
    Moderator
    Posted 16 years ago #

    Those two things you quoted are related. :) It's for themes that have text over the banner - you know, the blog title/link and tagline.

  15. Ovidiu
    Member
    Posted 16 years ago #

    k, did you fix what the other guy was moaning about?

  16. andrea_r
    Moderator
    Posted 16 years ago #

    Yep. Just code in the post. The text file was fine.

  17. aelroy
    Member
    Posted 16 years ago #

    I followed the instructions and corrections in this thread to establish a custom header image option in the blogs, however I am receiving the following warning upon upload of the image.

    Warning: call_user_func_array() [function.call-user-func-array]: First argumented is expected to be a valid callback, 'pressrow_admin_header_style' was given in /var/www/vhosts/brainbites.info/httpdocs/wp-includes/plugin.php on line 339

    Obviously something with the 'pressrow_admin_header_style' string is not right, but since I am not familiar with the mechanism of callign the functions and its logic, I do not know where to start deconstructing it.

    How do I find the theme name as far as WPMU is concerned? The folder is named pressrow, but I suspect it is identified to WP with a different name.

    TIA

  18. NenaGb
    Member
    Posted 15 years ago #

    I am having the worst luck in understanding this...can anyone out there assist? I get confused when it says :

    add_custom_image_header(’header_style’, ‘atypxmas_admin_header_style’); // change atypxmas to your theme name you used above.

    i have wordpressmu and buddypress successfully installed and just would like to add this last special touch to anyone that signs up for a blog so they can customize their header image. please help.

    thanks in advance.

  19. andrea_r
    Moderator
    Posted 15 years ago #

    Find this line:

    add_custom_image_header(’header_style’, ‘atypxmas_admin_header_style’);

    See where it says "atypxmas"? Change it to your theme name, the same one you used higher up in the file..

About this Topic

  • Started 16 years ago by worldblogosphere
  • Latest reply from andrea_r