Assuming that you’ve copied that options-page.php to the new theme, and you’re editing the right one, I have an idea for you.
As you know, generally your new theme’s files should now take precedence when that theme is selected. But there is an exception to that… “Theme Functions”, aka functions.php, is still pulled from the parent theme.
Take a peek at your new theme’s functions.php in Appearance… Edit. You will see a reference to options-page.php. As far as I can tell, this is pointing to the parent’s folder, and that’s why you’re not pulling in your new version. I believe you will need to edit that line to point to your child theme’s folder. You’ll have to work out the exact syntax. I think that should do it!
That worked, but doesn’t that kind of defeat the purpose of a child theme? I wonder if there is a way to do this without modifying the original template so I don’t have to reinsert that line each time the template is updated. but until i find out how,…this works. thank you very much.
My method, as described above, should work without changing the original template file. To put it another way, my instructions describe how to edit the child theme’s file, not the original theme’s file. As long as you edit the child theme’s options-page.php, you should have no problem updating the parent theme while retaining your child theme changes.
So you had a little extra work, but it should be over now, unless you mis-read the instructions. btw, this would require that you have copied functions.php to the child theme, and maybe you hadn’t done that.
i did move the functions.php over to the child, but the reason I had to make the declaration in the parent theme rather than the child theme, is that the main theme already requires options-page.php
require_once( P2_INC_PATH . '/options-page.php' );
so when i include the updated path as
require_once( STYLESHEETPATH . '/inc/options-page.php' );
it says i can’t re declare a class that is called from the main functions file
P2 child themes work great when all you have is css/layout tweaks and some basic addons that don’t change the basic p2 functions. Other types of edits such as these can get messy and it kind of defeats the purpose of easy updates because it introduces a hassle to make everything work. P2’s a theme that gets continually updated so if you’re making significant changes you can easily either break your theme or lose out on updated code. If you go with flamenco’s solution for example, if a future p2 update includes changes to the original options-page.php file, you’re missing out on it (and it could break your theme if other updated code relies on the changes).
I hope the great folks behind P2 think about making substantial customization more user friendly. Some ideas are adding hooks, converting part of P2’s functionality into a plugin or putting together more theme settings options that cover popular features such as category selection and giving users more control over what boxes/post types appear.
As it stands sometimes it’s more convenient to forgo theme updates when you have made significant modifications, which is only fine as long as there are no security holes needing to be plugged/or bug fixes needing to be corrected.
thanks. i kind of figured p2 was a special case. i’ve made some pretty significant customiztions, so i guess i’ll just forgo updates for this project. Just a personal project anyway. thank you every one for your answers. 🙂
Sorry my fix didn’t quite sort it. That’s interesting to find out that the child’s function.php doesn’t override, or at least it conflicts with, the parent site’s one. In my child themes, it’s generally been simply to work with styling, and bits of HTML here and there, and they’re super-handy for that.
Though I took a look at P2, I didn’t delve in deeply. At least we have some paths to follow when a child theme doesn’t work as predicted.
- The topic ‘Theme Options in Child Theme’ is closed to new replies.