ThemeShaper Forums » Thematic

[closed]

Parse error!

(14 posts)
  • Started 2 years ago by timothyd
  • Latest reply from onelittlemoose
  • This topic is resolved
  1. timothyd
    Member

    I have just switched over from my locally designed wordpress to the real thing and encountered this error:

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

    Here is my functions.php in my child theme.

    <?php
    function childtheme_create_stylesheet() {
    $templatedir = get_bloginfo('template_directory');
    $stylesheetdir = get_bloginfo('stylesheet_directory');
    ?>
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/reset.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/typography.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/images.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/layouts/2c-l-fixed.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/18px.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $stylesheetdir ?>/style.css" />
    <?php
    function remove_access() {
    remove_action( 'thematic_header', 'thematic_access', 9 );
    }
    add_action( 'init', 'remove_access' );
    ?>
    <?php
    function childtheme_override_postheader_postmeta() {

    $postmeta = '<div class="entry-meta">';
    $postmeta .= thematic_postmeta_entrydate();
    $postmeta .= thematic_postmeta_editlink();
    $postmeta .= "</div><!-- .entry-meta -->\n";

    return apply_filters('thematic_postheader_postmeta',$postmeta);
    }
    ?>
    <?php
    $entrydate = '<span class="meta-prep meta-prep-entry-date">' . __('Published: ', 'thematic') . '</span>';
    function childtheme_override_postmeta_entrydate() {

    $entrydate = '<span class="meta-prep meta-prep-entry-date">' . __('', 'thematic') . '</span>';
    $entrydate .= '<span class="entry-date"><abbr class="published" title="';
    $entrydate .= get_the_time(thematic_time_title()) . '">';
    $entrydate .= get_the_time(thematic_time_display());
    $entrydate .= '</abbr></span>';

    return apply_filters('thematic_post_meta_entrydate', $entrydate);
    }
    ?>
    <?php
    // CHANGE THE WAY CATEGORIES AND THE EDIT LINK ARE DISPLAYED (HIDE THEM)
    function childtheme_postfooter_postcategory($postcategory) {
    $postcategory = '';
    }
    add_action('thematic_postfooter_postcategory','childtheme_postfooter_postcategory');
    ?>

    Line 48, as mentioned in the parse error, is the last one.

    Posted 2 years ago #
  2. timothyd
    Member

    Ps. Line 48 is the last line in the functions.php document. I have read about empty space being an issue.

    Posted 2 years ago #
  3. onelittlemoose
    Member

    Just an observation and I don't know if this would make any difference, but I don't think you need to wrap each bit in <?php ?> If's all php, then you should only need one to open at the start, and the other to close at the end.

    Posted 2 years ago #
  4. timothyd
    Member

    Ok I deleted the extra <?php ?>. Now the parse error says it is on line 5. Here is my code now.

    <?php
    function childtheme_create_stylesheet() {
    $templatedir = get_bloginfo('template_directory');
    $stylesheetdir = get_bloginfo('stylesheet_directory');
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/reset.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/typography.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/images.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/layouts/2c-l-fixed.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/18px.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $stylesheetdir ?>/style.css" />
    function remove_access() {
    remove_action( 'thematic_header', 'thematic_access', 9 );
    }
    add_action( 'init', 'remove_access' );
    function childtheme_override_postheader_postmeta() {
    $postmeta = '<div class="entry-meta">';
    $postmeta .= thematic_postmeta_entrydate();
    $postmeta .= thematic_postmeta_editlink();
    $postmeta .= "</div><!-- .entry-meta -->\n";
    return apply_filters('thematic_postheader_postmeta',$postmeta);
    }
    $entrydate = '<span class="meta-prep meta-prep-entry-date">' . __('Published: ', 'thematic') . '</span>';
    function childtheme_override_postmeta_entrydate() {
    $entrydate = '<span class="meta-prep meta-prep-entry-date">' . __('', 'thematic') . '</span>';
    $entrydate .= '<span class="entry-date"><abbr class="published" title="';
    $entrydate .= get_the_time(thematic_time_title()) . '">';
    $entrydate .= get_the_time(thematic_time_display());
    $entrydate .= '</abbr></span>';
    return apply_filters('thematic_post_meta_entrydate', $entrydate);
    }
    // CHANGE THE WAY CATEGORIES AND THE EDIT LINK ARE DISPLAYED (HIDE THEM)
    function childtheme_postfooter_postcategory($postcategory) {
    $postcategory = '';
    }
    add_action('thematic_postfooter_postcategory','childtheme_postfooter_postcategory');
    ?>

    On line 5 is: <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/reset.css" />

    Posted 2 years ago #
  5. onelittlemoose
    Member

    timothyd, this seems to have narrowed down the problem, but beyond identifying it I fear I'm not much help. Line 5 is using html, which is, I believe, the problem. The html part might need to be contained in a variable first.
    <link rel="stylesheet" type="text/css" href= and then added in to the rest.

    Can someone more knowledgeable assist in the rest?

    Posted 2 years ago #
  6. timothyd
    Member

    Well thank you for your help thus far. I used those link tags because following Ian Stewart's instructions here:

    http://themeshaper.com/2009/04/30/modular-css-wordpress-child-themes/

    Posted 2 years ago #
  7. please wrap code between backtick marks `

    also, only looking quickly... i think you failed to close the php brackets before

    $stylesheetdir = get_bloginfo('stylesheet_directory');
    Posted 2 years ago #
  8. timothyd
    Member

    Ok I think I wrapped all the code that was in backtick marks. I am not sure what you mean about closing the php brackets before. Thanks for your help.

    <?php
    function childtheme_create_stylesheet() {
    $templatedir = get_bloginfo('template_directory');
    $stylesheetdir = get_bloginfo('stylesheet_directory');
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/reset.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/typography.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/images.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/layouts/2c-l-fixed.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/18px.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $stylesheetdir ?>/style.css" />
    function remove_access() {
    remove_action( 'thematic_header', 'thematic_access', 9 );
    }
    add_action( 'init', 'remove_access' );
    function childtheme_override_postheader_postmeta() {
    $postmeta = ('<div class="entry-meta">');
    $postmeta .= thematic_postmeta_entrydate();
    $postmeta .= thematic_postmeta_editlink();
    $postmeta .= "</div><!-- .entry-meta -->\n";
    return apply_filters('thematic_postheader_postmeta',$postmeta);
    }
    $entrydate = ('<span class="meta-prep meta-prep-entry-date">') . __('Published: ', 'thematic') . ('</span>');
    function childtheme_override_postmeta_entrydate() {
    $entrydate = ('<span class="meta-prep meta-prep-entry-date">') . __('', 'thematic') . ('</span>');
    $entrydate .= ('<span class="entry-date"><abbr class="published" title="');
    $entrydate .= get_the_time(thematic_time_title()) . '">';
    $entrydate .= get_the_time(thematic_time_display());
    $entrydate .= ('</abbr></span>');
    return apply_filters('thematic_post_meta_entrydate', $entrydate);
    }
    // CHANGE THE WAY CATEGORIES AND THE EDIT LINK ARE DISPLAYED (HIDE THEM)
    function childtheme_postfooter_postcategory($postcategory) {
    $postcategory = ('');
    }
    add_action('thematic_postfooter_postcategory','childtheme_postfooter_postcategory');
    ?>

    Posted 2 years ago #
  9. you're still not using backticks to wrap code. type 1 backtick... paste all your code... type the closing backtick.

    "I am not sure what you mean about closing the php brackets before. Thanks for your help."

    it means that you must wrap php code by opening with <?php and closing with ?> on line 4 it looks like you are forgetting to close your php tag before switching to plain HTML on line 5

    so you are technically trying to parse:

    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/reset.css" />

    as if it were PHP. hence, the parse error.

    Posted 2 years ago #
  10. timothyd
    Member

    Ok I added ?> after line 4. I don't really understood the backticks. You're saying I just need one backtick at the beginning and one at the end of the document, and all my code goes in between. Or I individually wrap.

    The parse error has now changed to line 38, the last line.

    <?php
    function childtheme_create_stylesheet() {
    $templatedir = get_bloginfo('template_directory');
    $stylesheetdir = get_bloginfo('stylesheet_directory');
    ?>
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/reset.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/typography.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/images.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/layouts/2c-l-fixed.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $templatedir ?>/library/styles/18px.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo $stylesheetdir ?>/style.css" />
    <?php
    function remove_access() {
    remove_action( 'thematic_header', 'thematic_access', 9 );
    }
    add_action( 'init', 'remove_access' );
    function childtheme_override_postheader_postmeta() {
    $postmeta = ('<div class="entry-meta">');
    $postmeta .= thematic_postmeta_entrydate();
    $postmeta .= thematic_postmeta_editlink();
    $postmeta .= "</div><!-- .entry-meta -->\n";
    return apply_filters('thematic_postheader_postmeta',$postmeta);
    }
    $entrydate = ('<span class="meta-prep meta-prep-entry-date">') . __('Published: ', 'thematic') . ('</span>');
    function childtheme_override_postmeta_entrydate() {
    $entrydate = ('<span class="meta-prep meta-prep-entry-date">') . __('', 'thematic') . ('</span>');
    $entrydate .= ('<span class="entry-date"><abbr class="published" title="');
    $entrydate .= get_the_time(thematic_time_title()) . '">';
    $entrydate .= get_the_time(thematic_time_display());
    $entrydate .= ('</abbr></span>');
    return apply_filters('thematic_post_meta_entrydate', $entrydate);
    }
    // CHANGE THE WAY CATEGORIES AND THE EDIT LINK ARE DISPLAYED (HIDE THEM)
    function childtheme_postfooter_postcategory($postcategory) {
    $postcategory = ('');
    }
    add_action('thematic_postfooter_postcategory','childtheme_postfooter_postcategory')
    ?>

    Posted 2 years ago #
  11. you only need the backticks to post in the forum to make code easier to read like in my post. it has nothing to do with what goes in your functions.php

    you are missing a ; at the end of

    add_action('thematic_postfooter_postcategory','childtheme_postfooter_postcategory');

    almost all php lines must end with a ;

    parse errors mean your code is incorrect and usually means you are missing something such as a ; , ) ?> etc. look closely at the line in question and the lines immediately preceding it.

    Posted 2 years ago #
  12. timothyd
    Member

    Thank you for all your help! I think I took the easy way out by simply removing all my child theme files, starting over with the Thematic child theme provided files, and then one by one putting back my templates and functions. Seems to be fine. Although probably have some little things to work out.

    www.timewithtimothy.com

    Posted 2 years ago #
  13. that is my time-tested debug method. please mark the thread as resolved.

    Posted 2 years ago #
  14. onelittlemoose
    Member

    oops, timothyd, I think I gave you bad advice in the beginning. My apologies. Glad it is resolved, though.

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.