Skip to content

Instantly share code, notes, and snippets.

@ahgood
Created June 1, 2018 02:04
Show Gist options
  • Save ahgood/efc2f4bdc76c11956d66c3c05c80a55a to your computer and use it in GitHub Desktop.
Save ahgood/efc2f4bdc76c11956d66c3c05c80a55a to your computer and use it in GitHub Desktop.
WordPress Get Started
# Download and install XAMPP
https://www.apachefriends.org/download.html
# Create a database, you may need to cd to mysql bin folder first to execute mysql command
cd /path/to/mysql/bin
mysql -u root -p
enter
create database db_name_you_want;
exit
*default mysql username: root, password is empty.
# Download and install WordPress
https://wordpress.org/latest.zip
# Create child theme in a folder and save this folder to /wp-content/themes/
1. style.css
/*
Theme Name: My theme
Template: twentyseventeen
*/
2. functions.php
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
# Create custom post type like products, a way to make it is install and use plugin:
WCK - Custom Fields and Custom Post Types Creator
# A way to enable custom layout for page or post, install following plugins:
Page Builder by SiteOrigin
SiteOrigin Widgets Bundle
# To create fully custom layout page, you need to create a template file:
1. Create a page in backend and get the page slug, for example, if your page title is My Page, the slug usually will be my-page;
2. Use a html file which contain the layout you like, save it as name page-my-page.php to /wp-content/themes/your-actived-theme/
# To show your page title/content in your custom template:
<?php the_title(); ?>
<?php
while (have_posts()) : the_post();
the_content();
endwhile;
wp_reset_query();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment