This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Updating child theme

  • Creator
    Topic
  • #17688
    davidcpa135
    Participant

    Learning from one’s mistakes is effective although time consuming. I’m running current version of Alyeska with the child theme.
    Backed up the site to a local enviroment for testing.
    Made changes to the child theme’s functions.php file.
    All changes effective on localhost (you may sense a but coming here)

    Logged onto FTP and renamed server child theme functions.php to functions.old.
    FTP’d new functions file and set permissions to 0644.
    Everything goes nuts on site.

    I’ve restored everything and ready to try again–just want to know if the above steps are a valid method of updating the functions file in the child theme.

    Part 2–As part of the trouble shooting I turned on debug in the wp-config.php file. Even after successful restore debug is referring to all kinds of depreciated statements in the functions file that is part of the w-p /includes directory (as opposed to child them).

    Here’s a screenshot
    http://www.screencast.com/users/Davidcpa/folders/Snagit/media/9e387424-cbd0-40c6-9651-25fd9c2043dd

    Wordpress is always up to date.
    Are the debug comments anything to worry about? Seems to have no harmful effect.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #17690
    Jason Bobich
    Keymaster

    Logged onto FTP and renamed server child theme functions.php to functions.old.

    This part doesn’t quite make sense. The child theme remains untouched when you update. That’s the idea behind the child theme. You’re only updating the parent theme. All you do is replace the parent theme (the “alyeska” folder) with the updated parent theme.

    I think what you’re intending to do is backup the parent theme. So, for example maybe you might change the parent theme folder to “alyeska-old” and then upload the new alyeska folder.

    Does that make sense?

    Then after you’ve updated the parent theme, make sure that your site is still working with your child theme in place.

    Are the debug comments anything to worry about? Seems to have no harmful effect.

    They aren’t really anything to worry about, however I think they’re all coming because you’re using an old version of the theme. If you’re all up to date, there should be any of these warnings from our theme, I don’t believe.

    #17691
    davidcpa135
    Participant

    Jason,
    I may not have been clear enough on the post. Child theme is up and running fine for some time. My goal is add some code (reproduced below) to the functions.php file. Logically, it should be put into the functions file in the child theme. So far so good.

    Question is –if I have the child theme modificed successfully on the localhost. Can I just ftp the modified functions.php up to the server letting it replace the old version. Anything to look out for?

    Thanks again for the help.

    If needed here’s the code I’m adding

    <?php
    /*
    Plugin Name: Link PDF Attachment
    Plugin URI: http://premium.wpmudev.org
    Description: Adds a link to the top of a WordPress post to the first PDF attachment
    Author: Chris Knowles
    Version: 1.0
    Author URI: http://twitter.com/ChrisKnowles
    */
     
    function pdf_add_link( $content ) {
     
    global $post;
    if ( !is_single() ) return $content;
     
    $args = array(
    'numberposts' => 1,
    'order' => 'ASC',
    'post_mime_type' => 'application/pdf',
    'post_parent' => $post->ID,
    'post_status' => null,
    'post_type' => 'attachment',
    );
     
    $attachments = get_children( $args );
     
    if ( $attachments ) {
    foreach ( $attachments as $attachment ) {
    $content = '<div class="pdf_download"><a href="' . wp_get_attachment_url( $attachment->ID ) . '" target="_blank" >Download extra client information as PDF</a></div>' . $content;	
    }
    }
    return $content;
    }
     add_filter( 'the_content' , 'pdf_add_link' );
    }
    ?>
    #17692
    Jason Bobich
    Keymaster

    In your local environment, open up functions.php of the child theme, and add in your code after what you already have in your functions.php.

    Your child theme’s functions.php (assuming you’re using the example I provided to start originally) already has PHP running, so you don’t need this at the top.

    <?php

    And the following is how you register a plugin, and obviously would not go in your child theme’s functions.php. If you were putting this code into a plugin, you’d need this information.

    /*
    Plugin Name: Link PDF Attachment
    Plugin URI: http://premium.wpmudev.org
    Description: Adds a link to the top of a WordPress post to the first PDF attachment
    Author: Chris Knowles
    Version: 1.0
    Author URI: http://twitter.com/ChrisKnowles
    */

    And this doesn’t really matter, but you don’t need this at the end of the file:

    ?>

    With what you’re doing here, you may want to read these:

    http://codex.wordpress.org/Writing_a_Plugin

    http://www.smashingmagazine.com/2011/09/30/how-to-create-a-wordpress-plugin/

    #17693
    Jason Bobich
    Keymaster

    You’ve got WP_DEBUG on so if something in the code you’ve added breaks, you’ll get an error, and you can assess.

    #17694
    Jason Bobich
    Keymaster

    Question is –if I have the child theme modificed successfully on the localhost. Can I just ftp the modified functions.php up to the server letting it replace the old version. Anything to look out for?

    If it works locally, you’re most likely good to go. Just update the files. It also doesn’t hurt to have backups, though.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.