Last active
September 17, 2017 22:55
-
-
Save igorbenic/89f6a7583e3fe0c7f36d3905efacd5ee to your computer and use it in GitHub Desktop.
The Beginner's Guide to WordPress Theme Development | http://www.ibenic.com/beginners-guide-wordpress-theme-development
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'wp_enqueue_scripts', 'child_theme_styles' ); | |
| function child_theme_styles() { | |
| wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'wp_enqueue_scripts', 'enqueue' ); | |
| function enqueue() { | |
| wp_enqueue_style( 'style', get_stylesheet_uri() ); | |
| // Example of another CSS: inside the theme folder /css/ without any dependencies (false), version: 1.1 and for all media | |
| wp_enqueue_style( 'style-css-2', get_template_directory_uri() . '/css/style-2.css', false, '1.1', 'all' ); | |
| // Enqueueing Script inside the theme folder /js/ with jQuery dependency. Version 1.1 and enqueued in the footer (true) | |
| wp_enqueue_script( 'script', get_template_directory_uri() . '/js/script.js', array ( 'jquery' ), 1.1, true); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function my_theme_function() { | |
| register_nav_menus( array( | |
| 'primary' => __( 'Primary Menu', 'myfirsttheme' ), | |
| 'secondary' => __('Secondary Menu', 'myfirsttheme' ) | |
| )); | |
| } | |
| add_action( 'after_setup_theme', 'my_theme_function' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if( have_posts() ) { | |
| while( have_posts() ) { | |
| the_post(); // set the next post in the loop as the current post | |
| //Display the Title | |
| the_title(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Theme Name: Your Theme Child | |
| Theme URI: https://your.theme.url | |
| Template: yourthemename | |
| ... | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Theme Name: Your Theme Name | |
| Theme URI: https://your.theme.url | |
| Author: Theme Author | |
| Author URI: Authour URL | |
| Description: Theme Description | |
| Version: 1.0 | |
| License: GNU General Public License v2 or later | |
| License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
| Text Domain: yourtextdomain | |
| Tags: blue, white, responsive | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment