Home>Support>Creating “Vantage” Child Theme with a new “functions.php” file

Creating “Vantage” Child Theme with a new “functions.php” file

I’m trying to customize a couple of page templates in the Vantage Premium theme, so I’m following best practices and making those changes in a child theme. I looked up the WordPress Codex official instructions on how to create a child theme, and they explicitly state that relying entirely on a “style.css” with an “@import” command is no longer best practice.
So, following the WordPress Codex instructions, I created a “style.css” file and a “functions.php” file along with it. Here are the contents of the “functions.php” file. I believe I’ve added them correctly, following the WordPress instructions at “https://codex.wordpress.org/Child_Themes”:

URL: http://www.franlevy.com

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 18 days ago joker6solitaire

    Half of my question was cut off!

    Here is the code written in my “functions.php” file for the child theme:

    <?php
    
    	add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    	function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    	}
    
    	function theme_enqueue_styles() {
    
        $parent_style = 'parent-style';
    
        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style )
        );
    	}
    
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    
  2. 9 years, 18 days ago joker6solitaire

    And the contents of my “style.css” file:

    /*
     Theme Name:   Vantage Child
     Theme URI:    http://www.franlevy.com/blog/wp-content/themes/vantage-child/
     Description:  Vantage Child Theme
     Author:       Fran Levy
     Author URI:   http://www.franlevy.com
     Template:     vantage
     Version:      1.0.0
     License:      GNU General Public License v2 or later
     License URI:  http://www.gnu.org/licenses/gpl-2.0.html
     Tags:         responsive-layout, fluid-layout, custom-background, custom-menu, featured-images, theme-options, threaded-comments, translation-ready, black, white, light, one-column, two-columns, full-width-template
     Text Domain:  vantage-child
    */
    
    
  3. 9 years, 18 days ago joker6solitaire

    (Question continued)

    When I load the child theme folder via FTP, I try to preview/activate it via the WordPress Dashboard. But I always get the following error message:

    “Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    More information about this error may be available in the server error log.”

    What am I missing from my child theme for a correct installation?

  4. 9 years, 18 days ago Andrew Misplon
    Hi, I Work Here

    Hi Joker6solitaire

    Thanks for reaching out :)

    If you’d like to give our Vantage starter theme a try, you can find it here:

    https://siteorigin.com/wp-content/uploads/2015/03/vantage-child-starter.zip

  5. 9 years, 18 days ago joker6solitaire

    This child theme works smoothly so far. Thank you for your help!

  6. 9 years, 17 days ago Andrew Misplon
    Hi, I Work Here

    For sure :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More