• Theramblingcrees

    (@theramblingcrees)


    I tried to add a widget sidebar to my Saga theme after reading a different forum on www.ads-software.com. I am new to blogging and have never used coding before, go figure, I’ve messed it up! I added the widget coding to my functions.php theme on my blog and now I cannot access my blog and this error message keeps popping up:

    Parse error: syntax error, unexpected ‘<‘ in /home/content/p3pnexwpnas04_data01/08/2313108/html/wp-content/themes/saga/functions.php on line 80

    Is there anything I can do? Or will I have to redownload wordpress and re-do my blog all over again?

    Thanks for the help!!

Viewing 15 replies - 1 through 15 (of 20 total)
  • Craig Ralston

    (@craig-ralston)

    Can you provide the code you are referring to? It’s just a syntax error, meaning you probably just have a typo in the code somewhere.

    Thread Starter Theramblingcrees

    (@theramblingcrees)

    Hi Craig,

    this is the code that I am referring to:

    <?php
    /**
    * “Oh, when I look back now / That summer seemed to last forever / And if I had the choice /
    * Yeah, I’d always wanna be there / Those were the best days of my life” – Bryan Adams (Summer of ’69)
    *
    * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
    * General Public License as published by the Free Software Foundation; either version 2 of the License,
    * or (at your option) any later version.
    *
    * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
    * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    *
    * You should have received a copy of the GNU General Public License along with this program; if not, write
    * to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    *
    * @package Saga
    * @subpackage Functions
    * @author Justin Tadlock <[email protected]>
    * @copyright Copyright (c) 2014, Justin Tadlock
    * @link https://themehybrid.com/themes/saga
    * @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    */

    /* Get the template directory and make sure it has a trailing slash. */
    $saga_dir = trailingslashit( get_template_directory() );

    /* Load the Hybrid Core framework and theme files. */
    require_once( $saga_dir . ‘library/hybrid.php’ );
    require_once( $saga_dir . ‘inc/custom-background.php’ );
    require_once( $saga_dir . ‘inc/custom-header.php’ );
    require_once( $saga_dir . ‘inc/custom-colors.php’ );
    require_once( $saga_dir . ‘inc/theme.php’ );
    require_once( $saga_dir . ‘inc/customize.php’ );

    /* Launch the Hybrid Core framework. */
    new Hybrid();

    /* Set up the theme early. */
    add_action( ‘after_setup_theme’, ‘saga_theme_setup’, 5 );

    /**
    * The theme setup function. This function sets up support for various WordPress and framework functionality.
    *
    * @since 1.0.0
    * @access public
    * @return void
    */
    function saga_theme_setup() {

    /* Enable custom template hierarchy. */
    add_theme_support( ‘hybrid-core-template-hierarchy’ );

    /* The best thumbnail/image script ever. */
    add_theme_support( ‘get-the-image’ );

    /* Pagination. */
    add_theme_support( ‘loop-pagination’ );

    /* Nicer [gallery] shortcode implementation. */
    add_theme_support( ‘cleaner-gallery’ );

    /* Better captions for themes to style. */
    add_theme_support( ‘cleaner-caption’ );

    /* Automatically add feed links to <head>. */
    add_theme_support( ‘automatic-feed-links’ );

    /* Post formats. */
    add_theme_support(
    ‘post-formats’,
    array( ‘aside’, ‘audio’, ‘chat’, ‘image’, ‘gallery’, ‘link’, ‘quote’, ‘status’, ‘video’ )
    );

    /* Editor styles. */
    add_editor_style( saga_get_editor_styles() );

    /* Handle content width for embeds and images. */
    hybrid_set_content_width( 1100 );
    }

    Thank you!

    kmessinger

    (@kmessinger)

    Why are you changing the theme’s functions.php file?

    You can replace the file with a clean one from the theme.

    If you want to change things you need a child theme.
    https://codex.www.ads-software.com/Child_Themes

    You can also ask for help here,
    https://codex.www.ads-software.com/Child_Themes

    Craig Ralston

    (@craig-ralston)

    Is that the entire functions.php? The error message points to line 80 whereas the code you posted ends at line 79.

    Also, @kmessinger is entirely correct – You should make edits via a Child Theme and not edit the theme files themselves or you will lose your changes the next time the theme updates.

    kmessinger

    (@kmessinger)

    The best way is to find a theme that allows widgets.

    Thread Starter Theramblingcrees

    (@theramblingcrees)

    I tried to add widgets to my Saga theme functions.php. with no prior knowledge of code and did little research aside from finding a forum on www.ads-software.com on how to add widgets…bad idea. This is the link to the Saga theme functions.php code that I found on www.ads-software.com, it looks the same and only has 79 lines:

    https://themes.trac.www.ads-software.com/browser/saga/1.0.1/functions.php?rev=38055

    After Line 79 I had copy and pasted the code for adding widgets to my theme that I also found on a forum on www.ads-software.com.

    So where do I go from here?

    Thread Starter Theramblingcrees

    (@theramblingcrees)

    Craig Ralston

    (@craig-ralston)

    After Line 79 I had copy and pasted the code for adding widgets to my theme that I also found on a forum on www.ads-software.com.

    That is the code I was asking you to provide as that is likely where the syntax error is – Can you post the additional code that you added?

    Also, please follow the guide @kmessinger provided and use the child theme functions.php to add your new code – You don’t want to be editing core theme files.

    Thread Starter Theramblingcrees

    (@theramblingcrees)

    I copy and pasted this code:

    <?php
    /**
    * Register our sidebars and widgetized areas.
    *
    */
    function arphabet_widgets_init() {

    register_sidebar( array(
    ‘name’ => ‘Home right sidebar’,
    ‘id’ => ‘home_right_1’,
    ‘before_widget’ => ‘<div>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2 class=”rounded”>’,
    ‘after_title’ => ‘</h2>’,
    ) );
    }
    add_action( ‘widgets_init’, ‘arphabet_widgets_init’ );
    ?>

    kmessinger

    (@kmessinger)

    Saga is a one column theme. You will have to add a sidebar for the widgets.
    https://codex.www.ads-software.com/Sidebars

    I am new to blogging and have never used coding before

    Make it easy on yourself. Find another theme. There are thousands of themes out there that you can install and start blogging instead of wasting time trying to reinvent the wheel. After you use WordPress a while you can try coding.

    Craig Ralston

    (@craig-ralston)

    If you added that right after line 79 – You shouldn’t be reopening the <?php tag. Remove <?php and see if you still get the syntax error.

    Thread Starter Theramblingcrees

    (@theramblingcrees)

    I cannot access anything in my blog admin- if I try to go through my wordpress.com account and then click on my ramblingcree.com/wp-admin link it brings me to the same error page.

    Thread Starter Theramblingcrees

    (@theramblingcrees)

    I immediately removed the add-widget code (restoring it to the original Saga functions.php that I had posted in this post initially) after I got the error and it is still coming up.

    Craig Ralston

    (@craig-ralston)

    Ok, that just threw me off – This is a self-hosted .ORG site, correct? WordPress.com should have nothing to do with it. How did you edit the file originally?

    Thread Starter Theramblingcrees

    (@theramblingcrees)

    We purchased the managed wordpress domain and hosting from godaddy. I had enabled editing on the appearance page > editor. I just literally copy and pasted below line 79 and now I cannot access anything at all on my domain or admin pages.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘I need help with a functions.php coding on my Saga Theme’ is closed to new replies.