WordPress.org

Ready to get started?Download WordPress

Forums

Child Theme Not Working (12 posts)

  1. dcloud
    Member
    Posted 3 years ago #

    I've got tired of always having to redo my whole site every time I update WP so I decided to make a child theme. I spent the morning checking on tutorials, and most of what I've found basically says to create a folder in "wp-content/themes" and name it what you want, then add a stylesheet and make sure the "head" section of the stylesheet has the following info...

    /*
    Theme Name: MyTheme
    Theme URI: http://wordpress.org/
    Description: Child Theme for Twenty Ten
    Author: John Smith
    Author URI: http://mysite.net/
    Template: twentyten
    Version: 0.1
    */

    @import url("../MyTheme/style.css");

    Well, I did all this, and all I get on the Theme page of my dashboard is "Broken Themes - The following themes are installed but incomplete. Themes must have a stylesheet and a template."

    If anyone could help me figure this out I would sure appreciate it. Thank you.

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    not:
    @import url("../MyTheme/style.css");

    but:
    @import url("../twentyten/style.css");

    this is to pull the parent theme's styles into your child theme; before thay get overwritten by your changes in style.css of your child theme.

  3. dcloud
    Member
    Posted 3 years ago #

    That doesn't make any sense, since the whole point of making a child theme is so that you can keep your changes (in the stylesheet of the child) when you update WP.

    I tried what you said and now nothing appears on the Theme page but Twenty Ten.

  4. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    I tried what you said and now nothing appears on the Theme page but Twenty Ten.

    my mistake - it actually does work without the @import line;
    or with a different import style.

    the only requirement is that the child theme has a style.css with this kind of code at the start:

    /*
    Theme Name: MyTheme
    Theme URI: http://wordpress.org/
    Description: Child Theme for Twenty Ten
    Author: John Smith
    Author URI: http://mysite.net/
    Template: twentyten
    Version: 0.1
    */

    http://codex.wordpress.org/Child_Themes

  5. dcloud
    Member
    Posted 3 years ago #

    That's exactly what I did. It's in my first post. The stylesheet for my child theme is in the child theme folder I created.

  6. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    is the folder structure and location of your child theme's style.css:

    /wp-content/themes/mytheme/style.css

  7. dcloud
    Member
    Posted 3 years ago #

    Yep, it's ... /wp-content/themes/2011/style.css

    I named it 2011, but I used generic info in the examples above.

  8. dcloud
    Member
    Posted 3 years ago #

    Ok, this is really interesting. I changed the name from 2011 to twenty-eleven and changed it in the stylesheet and now it appears on the Theme page. I guess WP can't handle themes with numerical names.

    Now to figure out how to make the screenshot and if I need to have any more files inside the child folder (like functions, index, etc.).

  9. demetris
    Member
    Posted 3 years ago #

    As I said in the comments at op111.net — http://op111.net/53/ — it seems there is a bug with theme names that have only numbers:

    http://core.trac.wordpress.org/ticket/15306

    Cheers!

  10. dcloud
    Member
    Posted 3 years ago #

    demetri, alchymyth, thanks for your help. On to another question: now that I have the theme appearing on the Themes page, what other files (besides the style.css) should I have in there?

    Say I have changes I made in loop.php and functions.php, and a couple other files - how would I include these in the child theme folder? Just as they are or do I have to make some changes to them?

    Thanks.

  11. markhem
    Member
    Posted 2 years ago #

    One little detail to remember; activate your child theme.

  12. ugg pas cher 2012
    Member
    Posted 2 years ago #

    not:
    @import url("../MyTheme/style.css");

    but:
    @import url("../twentyten/style.css");

    this is to pull the parent theme's styles into your child theme; before thay get overwritten by your changes in style.css of your child theme.

Topic Closed

This topic has been closed to new replies.

About this Topic