WordPress.org

Support

Support » Themes and Templates » Magazine Basic » [Resolved] Can't Add functions.php to Child Theme

[Resolved] Can't Add functions.php to Child Theme

  • Deborah Delin

    @deborahdelingmailcom

    Hi,

    I am using a child theme for magazine-basic. Now I need to add functions.php to the child theme but when I copy the file and add it to the main file of my child theme the site crashes and I get the following error:

    Fatal error: Cannot redeclare mb_styles() (previously declared in /home/photomob/public_html/wp-content/themes/magazine-basic-child/functions.php:92) in /home/photomob/public_html/wp-content/themes/magazine-basic/functions.php on line 101

    Thank you in advance for the help!

    Deborah

Viewing 12 replies - 1 through 12 (of 12 total)
  • A child theme’s functions.php does NOT replace the parent theme’s functions.php. From http://codex.wordpress.org/Child_Themes

    Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)

    If you can share what you’re trying to achieve I can give you a solution for it.

    Deborah Delin

    @deborahdelingmailcom

    Thanks for explaining Jesin! I wanted to edit functions.php so that I could create a widgetized area below the header where I can place a fixed image.

    But maybe I’m taking a sledgehammer to crack a nut here and there’s an easier way of doing it?

    Any input very gratefully recieved.

    Deborah

    There is already a widget area in the header named “Header Area“. You can find it in Appearance > Widgets.

    If you don’t like its location use CSS to move it around.

    However if what is want is an additional widget area use the register_sidebar() function in the child theme’s functions.php to create a widget area.

    Then copy the parent’s header.php to the child theme’s directory, edit it and add

    get_sidebar( 'sidebar_name' );

    wherever you want this widget to be displayed.

    Deborah Delin

    @deborahdelingmailcom

    Thank you!

    Could you please give me a hint as to how to move the Header Area Widget to below the header area using CSS? Where would I find the CSS which refers to this widget?

    Alternatively, regarding your second solution:

    However if what is want is an additional widget area use the register_sidebar() function in the child theme’s functions.php to create a widget area.

    as I mentioned, I was unable to create a functions.php file in my child theme. I copied the parent theme functions.php file and uploaded it to the child theme file and it broke the site.

    Thanks so much for your help.

    Deborah

    Deborah Delin

    @deborahdelingmailcom

    I’m still struggling with this. Magazine theme doesn’t seem to allow me to touch functions.php, either to add code to it or to copy it to the child theme folder. So I am unable to use register_sidebar() as Jesin suggested.

    I’d like to try moving the Header Area Widget downwards. Where is the CSS which I need to change located?

    Please help and thanks in advance.
    Deborah

    Use the following CSS code to move the widget below the logo.

    #header-widgets {
      clear: left;
      float: none;
    }

    Use a plugin like PC Custom CSS to place this code.

    Deborah Delin

    @deborahdelingmailcom

    I added the plugin and added the code you suggested above.

    Then I put an image in my header area. But the image appears at the top right of the header whereas I want it to the bottom right of the header, just under the menu bar. I tried adding some CSS to make it go lower but it is still top right. So sorry to need spoonfeeding like this but I’m lost. Please could you have a look at the site and suggest what I should do:
    http://www.photomobil.co.il/

    Code in Custom CSS at the moment:

    #header-widgets {
      clear: left;
      float: none;
    position:relative;
    top:250px;
    }

    The image I am trying to move under the menu bar is the three little flowers floating at top right of page.
    Thank you so much for your help!!!
    Deborah

    Remove the code you entered previously and use this code

    #header-widgets {
      position: absolute;
      right: 0;
      top: 245px;
    }

    This will move the three flowers below the menu.

    Deborah Delin

    @deborahdelingmailcom

    I got excited there but – it doesn’t! :-((

    I put exactly that code in Custom CSS. In Google Chrome the three flowers are still above the header and in IE and Firefox they are also above the header but are crunched up.

    Could it be because I am using an Image Widget in the header area?

    The Custom CSS plugin itself isn’t working because you do not have rewrite rules in your .htaccess file.

    Go to Settings > Permalinks and choose a permalink structure.

    Deborah Delin

    @deborahdelingmailcom

    Oh my goodness! That did it!! You are brilliant!!

    Thanks so much Jesin for your patient help! I would never have gotten there by myself!

    You’re most welcome Deborah!!

    If your problem is solved please mark this topic as resolved.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Resolved] Can't Add functions.php to Child Theme’ is closed to new replies.
Skip to toolbar