Children Children Children…

  • Anonymous

    #1905

    Okay, I’ve created my new child style.css file, and I have been reading the forum about how to use. I feel much more informed than I did yesterday.

    I think I understand the style.css file, and what I need to do.

    Here are my questions:

    1. I have made a few adjustments to my header and footer. I read these files must be placed, in their entirety, into the child theme. However, then I will be missing out if a future update changes these files. What is your recommendation, and can you point me in the right direction, about the best way to handle these two files?

    2. The functions.php file. Does this work the same way as the style.css file? Am I correct in assuming any function I paste, and change, in the child theme will take priority over the original in graphene functions.php?

    Thanks.

    Admin

    Syahir Hakim

    #17759

    You might want to give a read through of this wiki page: http://wiki.khairul-syahir.com/graphene-theme/wiki/Customisation_using_a_child_theme

    Anonymous

    #17760

    Excellent Reading!! Thanks for taking the time to post that… and linking me to it.

    Would you be able to provide me with a brief example of using an action or filter hook within the child’s functions.php file.

    Here is some code from my header.php. You can see the additions I made enclosed by my comments. It’s simply a div tag for an image.

    <?php if ($graphene_settings['hide_top_bar'] != true) : ?>
    <div id="top-bar">
    <div id="rss" class="clearfix">
    <?php if ($graphene_settings['hide_feed_icon'] != true) : ?>
    <?php $custom_feed_url = ($graphene_settings['custom_feed_url']) ? $graphene_settings['custom_feed_url'] : get_bloginfo('rss2_url'); ?>
    <a href="<?php echo $custom_feed_url; ?>" title="<?php printf(esc_attr__("Subscribe to %s's RSS feed", 'graphene'), get_bloginfo('name')); ?>" class="rss_link" <?php if ( $graphene_settings['social_media_new_window'] ) { echo 'target="_blank"'; } ?>><span><?php _e('Subscribe to RSS feed', 'graphene'); ?></span></a>
    <?php endif; ?>
    <?php do_action('graphene_feed_icon'); ?>
    </div>
    <!-- Josh Code -->
    <div id="followme"><img src="http://www.joshlobe.com/wp-content/images/follow.png"></div>
    <!-- End Josh Code -->
    <?php
    /**
    * Retrieves our custom search form.
    */
    Admin

    Syahir Hakim

    #17761

    To implement that change in a child theme’s functions.php file, you can probably do something like this:

    function josh_followme(){
    ?>
    <div id="followme"><img src="http://www.joshlobe.com/wp-content/images/follow.png"></div>
    <?php
    }
    add_action( 'graphene_feed_icon', 'josh_followme' );

    That would put the followme div right where the <?php do_action('graphene_feed_icon'); ?> code appears in the theme’s code.

    Notice that you don’t need to output the code exactly where you want it to be – there may not be any action hook available exactly where you want to place it – but you can always position it afterwards using CSS.

    Anonymous

    #17762

    Gosh, I’ve really got to start learning the next level of php. It seems the more I learn, the more I realize I don’t know!

    This is a perfect start!! I see now how the add_action works. I believe you just opened a door to a whole new world of possibilities for me.

    Thanks, my friend!

    Admin

    Syahir Hakim

    #17763

    Yeah, action and filter hooks really are the core to WordPress’ customisability and extensibility. You won’t regret taking the time to learn about it 🙂

    Anonymous

    #17764

    Okay, I’m gonna go try to install the update, and restore my changes using all child theme css and functions…. without touching ANY core file.

    Wish me luck!!

    Anonymous

    #17765

    I believe it. I want to take some certification courses. But I’m in grad school right now, raising the three year old on my own, working full time… shhsh!!

    But man, is this information ever valuable. This is what non-programmers pay $50-$60 an hour for people to do for them!

    I love technology!!

    Anonymous

    #17766

    Absolutely Amazing! I am blown away by the new possibilities you have helped me uncover. My head is going 100 miles per hour (or is it kilometers) thinking of new customizations now possible.

    @ Syahir… Thank you for helping me write my first php function!!

    Everything is great. My site is exactly the way I want it (for now), all my css and function changes were successful, and I didn’t touch ONE core file.

    Thanks guys!!

Viewing 9 posts - 1 through 9 (of 9 total)

  • You must be logged in to reply to this topic.