Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Miguel Lopez
Miguel Lopez
1,232 Points

used functions.php instead of @import, now when I try to change css it doesn't work

Instead of following the video's advice on using @import, I went ahead and looked for the functions.php alternative I saw on some people's questions. So I followed this article's advice: https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/ .

Now when it goes to the part of changing the style of the child theme, they suggest to simply add any css on style.css. In my case it would be: -----style.css file-----

/* Theme Name: Initio Child Theme URI: http://vmthemes.com/initio/ Description: Description: Initio is our flagship theme that has been designed from the ground up as a truly versatile Multi-Purpose Theme. It introduces a light, crisp, clean, yet very rich and powerful design that can be used to power any type of a web presence. It comes with a great variety of options that give you complete control and flexibility to customize the look and feel of the theme using the Customizer. Initio was built according to the industry's best practice of using a responsive web design. It provides customizable home page sections, Google fonts and Map Integration, unlimited colors, animation, and automatic image resizing. The Font Awesome icon pack delivers 605 Retina Ready icons that look absolutely amazing on an iPad, Tablet, or any other HD device. 4 footer widget columns, scroll to top feature, social links, support for WooCommerce, Contact Form 7 plugins, five post formats, and much much more. In a nutshell, Initio comes to you loaded with extensive and very rich functionality that will enable you to get your website up and running with the look and feel of your choice in a very short amount of time. Author: Miguel Lopez Author URI: http://errincondermigue.com/ Template: initio Version: 1.0.5.2 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: one-column, two-columns, right-sidebar, left-sidebar, grid-layout, custom-header, custom-logo, editor-style, footer-widgets, blog, e-commerce, photography, custom-background, custom-menu, custom-colors, featured-images, post-formats, theme-options, threaded-comments, translation-ready, full-width-template, featured-image-header Text Domain: initio-child */

content-box #post-body {

background: #ccc;

}

----- End of style.css file-----

this: #content-box #post-body { background: #ccc; } is what I wanted to add to the CSS to change the theme, but when I go into dev tools, it doesn't even appear as a command to the CSS of the theme.

this is the functions.php file as the article suggests:

-----funtions.php file-----

<?php //* Code goes here add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );

function enqueue_parent_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); }

-----End of functions.php file-----

Maybe I didn't explain myself properly, English is not my mother tongue and I am really out of practise so if anybody needed me to explain everything better I will. Thanks in advance for any help you cand provide and Happy New Year's Eve guys! ;)

1 Answer

Vishal Datt Wadhwa
Vishal Datt Wadhwa
1,989 Points

Hi,

To get started with a child theme for the first time I suggest you have a look at some plugin which would do the job for you so that you can understand the whole motive and functioning around it. Once that is done, you can try and replicate the files created by the plugin.

http://wordpress.org/plugins/one-click-child-theme/

Miguel Lopez
Miguel Lopez
1,232 Points

Thanks a lot Vishal, that was a really good idea ;D