Jump to content

Cre8asiteforums Internet Marketing
and Conversion Web Design


Photo

Wordpress Child Themes And Fancy New Features


  • Please log in to reply
19 replies to this topic

#1 DonnaFontenot

DonnaFontenot

    Peacekeeper Administrator

  • Site Administrators
  • 3828 posts

Posted 18 July 2011 - 05:31 PM

Michael Martinez began this in another unrelated thread by saying,

"I could modify the existing themes I'm using to use the information on the "author" page that Wordpress generates (essentially just a list of articles from the author). I've already hacked both Wordpress and one theme to do this, but I hate hacking software because the next upgrade wipes out the hack."

I then said:

the next upgrade wipes out the hack


Use a child theme to avoid that problem. And then just add as many templates as you want/need to handle every different page type imaginable. If you take a look at any of the modern themes being created today, you'll see the amazing flexibility there is now. Even the default Twenty Eleven theme shows some of that power. Another free one for you to pick apart is the Arras theme (arrastheme.com)

Once you start realizing the power of both child themes, and different page styles for different types of pages (portfolios, reviews, full page, sidebar here, sidebar there, etc.), you'll realize just how powerful it is - without ever messing with the core code.

WP has come a long, long way over the years. This ain't yo' momma's WordPress anymore.

---

The following are posts moved here to further this discussion.

#2 Michael_Martinez

Michael_Martinez

    Time Traveler Member

  • 1000 Post Club
  • 1354 posts

Posted 18 July 2011 - 05:41 PM

Thanks, Donna. I wasn't aware of child themes. I'll do some research and figure out a more stable solution.

#3 jonbey

jonbey

    Eyes Like Hawk Moderator

  • Moderators
  • 4433 posts

Posted 18 July 2011 - 08:00 PM

From Magazine Basic designer: http://bavotasan.com...e-in-wordpress/

#4 Michael_Martinez

Michael_Martinez

    Time Traveler Member

  • 1000 Post Club
  • 1354 posts

Posted 19 July 2011 - 01:41 PM

Perfect. That is exactly what I need, jonbey. Thanks.

Edited by Michael_Martinez, 19 July 2011 - 01:41 PM.


#5 jonbey

jonbey

    Eyes Like Hawk Moderator

  • Moderators
  • 4433 posts

Posted 19 July 2011 - 02:33 PM

I really need to do that. I have not set up child themes yet, just have a log of all the changes I have made. Although really mostly CSS anyway, with a few minor code changes.

#6 Michael_Martinez

Michael_Martinez

    Time Traveler Member

  • 1000 Post Club
  • 1354 posts

Posted 19 July 2011 - 04:46 PM

So I created a child theme for one site and switched to the theme. Worked beautifully. I then copied the files to another site and as soon as I switched to the theme I got an error 500. I have no idea of what led to that. I suspect I must have changed something else and forgot about it.

The error is actually caused by a modified "functions.php" where I added code for the Google +1 button. It works on one blog but not the other.

Both blogs are using the same version of Wordpress and the same version of Magazine-Basic.

Very odd.

ON EDIT:

I think the problem is that one blog is a single installation of Wordpress and the other blog is a multisite installation. Hence, things are working differently. I'll probably have to forget the Google +1 hack and go with a plugin now that they seem to be available (but I'm still being told the plugins haven't been tested with my version of Wordpress).

Edited by Michael_Martinez, 19 July 2011 - 05:12 PM.


#7 DonnaFontenot

DonnaFontenot

    Peacekeeper Administrator

  • Site Administrators
  • 3828 posts

Posted 19 July 2011 - 09:18 PM

Then you can be the tester. If they work, go to the plugin pages, and click either the Broken or Works button for your version. It's a community based testing functionality.

#8 Michael_Martinez

Michael_Martinez

    Time Traveler Member

  • 1000 Post Club
  • 1354 posts

Posted 20 July 2011 - 12:47 PM

I may do that. BTW -- I solved my error problem. Turns out I didn't need to copy the "functions.php" script into the child theme directory.

Donna -- I wonder if it wouldn't make sense to carve out some of this discussion to form a new thread?

I've now created 2 child themes, each of which is working on 2 or more blogs. I'm just so pleased with myself. :haha:

You can use child themes almost like skins, switching from one to the other while preserving the core functionality of the primary theme.

:nanaparty:

#9 AbleReach

AbleReach

    Peacekeeper Administrator

  • Site Administrators
  • 6467 posts

Posted 20 July 2011 - 04:31 PM

Here's the wordpress.org page on child themes: http://codex.wordpre...rg/Child_Themes

In a child theme, you only have to copy over the information that you're changing. Keeping in mind that I'm learning, too, so what I advise may not be as detailed as it may be in the future (!), these ideas may help you:

- If you want to add or re-define functions, you just add functions to the child theme's functions.php.
- If re-defining functions you may need to turn off the parent function. Here's an example: http://ottopress.com...p-child-themes/


I used to say that experimenting with Kubrick is a good way to learn. Now that there have been three default themes, I've amended that to loving to experiment with the default version of WordPress. I learned a lot from TwentyTen and I will learn more from TwentyEleven.

- The code is nicely commented.
- Seeing where things begin and end is much easier than it could be, because code that could be written as one big interwoven group of includes is separated into individual template files.
- Though the documentation at wordpress.org is not as updated as it could be, the combination of error message line numbers, the Theme Check plugin and turning on Debug Mode helps me track down exact terms to plunk into Search.

#10 Michael_Martinez

Michael_Martinez

    Time Traveler Member

  • 1000 Post Club
  • 1354 posts

Posted 20 July 2011 - 05:26 PM

I wonder if there is a market for child themes and what implications that may have for intellectual property rights. I'm not planning to sell or distribute my child themes but I can see how people might be able to build some broad platforms on common foundations.

Is that what BuddyPress is all about? Are people just creating child themes for BuddyPress? Doh! Now I think I understand some of the things I have been reading in the theme galleries.

#11 DonnaFontenot

DonnaFontenot

    Peacekeeper Administrator

  • Site Administrators
  • 3828 posts

Posted 20 July 2011 - 05:43 PM

There's always a market for themes - child themes or not.

There are quite a few theme "frameworks" (thesis, hybrid, genesis, etc.), that naturally lend themselves to having child themes created for them.

Of course, if you're creating a child theme based off of someone else's theme, you'll need to abide by whatever licensing it's distributed under.

But in general, yes, there's a market.

#12 Michael_Martinez

Michael_Martinez

    Time Traveler Member

  • 1000 Post Club
  • 1354 posts

Posted 20 July 2011 - 06:50 PM

Does anyone know if there is a way to tag or flag Wordpress pages internally, such that you can do specific things only to those internally t/flagged pages?

I don't want to do anything with category pages or tag pages (the things that users see).

I want to be able to embed a meta code in the HEAD section of a page and then implement some specific function or widget or whatever only for pages that have that code embedded in their HEAD sections.

Is there a plugin that allows you to do this?

Is this a good option for experimenting with a child theme?

Some examples of things I would want to associate with certain pages:
  • Targeted advertising (such as a book listing that appears on a group of pages across multiple categories that share a common topic or sub-topic)
  • Targeted widgets (such as a Twitter feed or RSS feed that appears on a group of pages across multiple categories ...)
  • Targeted graphics, pictures, logos, charts, etc. that appear on a group of pages across multiple categories ...
  • A small blurb of boilerplate text (like a warning or disclaimer) that appears on a group of pages across multiple categories ...


#13 jonbey

jonbey

    Eyes Like Hawk Moderator

  • Moderators
  • 4433 posts

Posted 20 July 2011 - 06:55 PM

If I understand you right, then you just need to create template pages / posts. Then when creating something where you want the embedded code you pick a specific template (instead of the default).
http://codex.wordpre..._Into_Templates

Then again, HEAD section, hhmmmm

#14 Michael_Martinez

Michael_Martinez

    Time Traveler Member

  • 1000 Post Club
  • 1354 posts

Posted 21 July 2011 - 02:47 AM

Well, I could add the tag/flag as a custom field. I think that lets you add meta items to the HEAD (I'm sure you can add meta descriptions that way).

#15 bwelford

bwelford

    Peacekeeper Administrator

  • Site Administrators
  • 9023 posts

Posted 21 July 2011 - 09:13 AM

This is all fascinating stuff. One question that comes to mind runs as follows:

Suppose I want to add some extra code in any of the standard template pages, e.g. header, sidebar, footer, single. From what I understand I put the modified file in the child subdirectory.

What then happens when the theme is updated. Do they ever change one of these fundamental building blocks? If so I imagine I miss what was included in that update for this particular file. Suppose it was something important. How will I know I should update my child template file to include this important feature?

#16 wiser3

wiser3

    Gravity Master Member

  • Members
  • 229 posts

Posted 21 July 2011 - 12:15 PM

I find this conversation of Wordpress people discovering new functionality that has been part of Joomla for years fascinating. The last time i looked at Wordpress i kept banging my head against the wall as i tried to get it to do things is wasn't designed for. Maybe it's evolved enough to have another look at.

#17 Michael_Martinez

Michael_Martinez

    Time Traveler Member

  • 1000 Post Club
  • 1354 posts

Posted 21 July 2011 - 12:57 PM

What then happens when the theme is updated. Do they ever change one of these fundamental building blocks? If so I imagine I miss what was included in that update for this particular file. Suppose it was something important. How will I know I should update my child template file to include this important feature?


As a software engineer I had to deal with this issue for years in multiple contexts. Many modifications will survive multiple upgrades in the core software but there comes a time when you have to re-engineer the modification to match the latest upgrade.

Donna's suggestion to use a child theme to hold the modified code makes complete sense because it isolates the change in a way that doesn't interfere with other code updates. Incremental updates rarely touch more than a small percentage of code so most of the scripts should remain unchanged.

This is a much more efficient way of handling user-side modifications than rewriting the scripts every time you run an update installation.

I find this conversation of Wordpress people discovering new functionality that has been part of Joomla for years fascinating. The last time i looked at Wordpress i kept banging my head against the wall as i tried to get it to do things is wasn't designed for. Maybe it's evolved enough to have another look at.


I have a lot of respect for Wordpress but in my opinion it is designed to be mass market-friendly and that means more sophisticated users will always find deficiencies in it. Maybe it's evolved enough to justify your looking at it but you may still find deficiencies in it.

I know I see some problems but they're not big enough to motivate me to implement alternative CMS solutions (yet).

#18 bwelford

bwelford

    Peacekeeper Administrator

  • Site Administrators
  • 9023 posts

Posted 21 July 2011 - 02:29 PM

I guess the other lesson here is to add adequate comments to whatever editing you do of fundamental files so that you can easily do a major update from the latest version if that becomes necessary. It would be handy in such a case to watch the various changes that may have occurred as the Theme is updated and react promptly when something important happens.

#19 Michael_Martinez

Michael_Martinez

    Time Traveler Member

  • 1000 Post Club
  • 1354 posts

Posted 21 July 2011 - 04:22 PM

Yes. Or create a comment file for the child theme that contains the specific code you added with instructions or listing the deletions you made and explaining why.

I guess it comes down to how much you change and how complex the change is to determine how extensive the documentation should be.

#20 AbleReach

AbleReach

    Peacekeeper Administrator

  • Site Administrators
  • 6467 posts

Posted 21 July 2011 - 09:01 PM

WordPress has been able to do child themes for a few years - it seems like it was mid to late in 2.x?

I googled and found this, from 2008.

I didn't see the point until WordPress's default theme started referencing functions.php more. Template pages used to just reference the function - 'primary-widget-area' - without mention of the theme. Now the theme name - 'twentyten' - is referenced.

I've taught myself a lot by experimenting, noticing what happens and searching for more information. Consequently, I did not know how things are said out loud, until YouTube. When reading "mySQL" I'd always heard "my s q l" in my head. It's a mind rush to suddenly be hearing YouTube videos where people are saying it as "my sequel." And the education continues. :)



RSS Feed

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users