WordPress

WordPress
WordPress - http://wordpress.org/

WordPress Codex has additional information on using WordPress - http://codex.wordpress.org/

WordPress Informational Sites

 * WordPress Codex - http://codex.wordpress.org/ (information on using WordPress)
 * http://digwp.com/
 * http://torquemag.io/
 * http://wp.smashingmagazine.com/

CMS
WordPress is a blogging tool and content management system (CMS).

WordPress separates the content, structure and style.

WordPress is generally used to host a Blog. A Blog is short for web log, and is kind of a journal.

Posts and Pages
An article written for a blog is called a post. Posts are stored linear, organized by date/subject/category/tags. Tags organize posts by specific subject, and categories ore more generic.

More static articles are called pages. Pages are stored hierarchically (parent/child).

Remember: pages are for standalone content, and posts are for blog articles.

Posts and pages can be edited with the Visual Editor, or HTML text editor.

The 'front page' is the first page people will see.

Tags and Categories
Tags organize posts by specific subject, and categories ore more generic.

"A post can live in more than one category and tag, but generally speaking posts usually have more tags than categories, since categories are broad subjects and tags are narrower. This isn’t a rule so much as a convention."

Appearance and Themes
Styles are managed through themes. This is where the CSS is kept.

Themes control the look of the site, and plugins add new functionality. Widgets are a special kind of plugin that goes into areas defined by a theme.

Full Theme CSS (and PHP code) can be modified through Dashboard -> Appearance -> Editor.

Child Theming - changes to code without destroying original code - https://codex.wordpress.org/Child_Themes

Plugins
Plugins add new functionality. Widgets are a special kind of plugin that goes into areas defined by a theme.

Example plugins: caching (for performance), adding credit card processing, SEO related, etc

"A shortcode is a type of code that you can copy and paste into an area of your site that automatically references a plugin, widget, or theme element."

"Widgets are a type of plugin that you can insert into your site to add a specific extra feature. Widgets tend to perform limited functions and can be slotted into only certain spots on a web page."

Dashboard
Content can be managed and organized through the Dashboard.

Photos
Photos can be managed with the Media Library. The Media Library is private.

"A featured image is often a panorama-style image that lives at the top of the page or post or a thumbnail image that lives next to the post. This can make your blog look quite appealing."

Menus
Menus can be placed in areas marked Theme Locations on a theme. Pages can be manually or automatically added to a menu.

Tagline
A slogan or one-sentence description of your site

Backend
WordPress is built on PHP and MySQL.

Installation
Install dependencies: yum install httpd mysql-server php php-mysql

Download: wget http://wordpress.org/latest.zip mv latest.zip wordpress.zip unzip wordpress.zip cd wordpress
 * 1) rename folder 'wordpress' if desired

Wizard: http://[server]/wp-admin http://[server]/wp-admin/setup-config.php

Config File: (or use the configure web page to create the wp-config.php cp wp-config-sample.php wp-config.php sudo chown apache wp-config.php # centos
 * 1) sudo chown www-data wp-config.php  # ubuntu

References:
 * Installing WordPress « WordPress Codex - http://codex.wordpress.org/Installing_WordPress

Configure Database
Create database: mysql -u root -e "CREATE DATABASE wordpress" mysql -u root -e "grant all on wordpress.* to wordpress@localhost identified by 'wordpress'" mysql -u root -e "flush privileges"

CREATE DATABASE wordpress; GRANT ALL PRIVILEGES ON wordpress.* TO "wordpressusername"@"hostname" IDENTIFIED BY "password"; FLUSH PRIVILEGES;

Configuration Wizard
Configuration Wizard: http://[host]/wordpress/
 * 1) visit:
 * 1) dump to wp-config.php if not created before

Edit Database Settings (wp-config.php): define('DB_NAME', 'database_name_here'); define('DB_USER', 'username_here'); define('DB_PASSWORD', 'password_here'); define('DB_HOST', 'localhost'); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', '');

/* generate these using https://api.wordpress.org/secret-key/1.1/salt/ */ define('AUTH_KEY',        'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('LOGGED_IN_KEY',   'put your unique phrase here'); define('NONCE_KEY',       'put your unique phrase here'); define('AUTH_SALT',       'put your unique phrase here'); define('SECURE_AUTH_SALT', 'put your unique phrase here'); define('LOGGED_IN_SALT',  'put your unique phrase here'); define('NONCE_SALT',      'put your unique phrase here');

Done! That's it. The site is now ready to use.

If you need to change settings later, login to the dashboard: http://[host]/wp-admin/

Enable Uploads
Enable uploads: cd wp-content mkdir uploads sudo chown apache uploads # centos
 * 1) sudo chown www-data uploads  # ubuntu

Themes
Using Themes « WordPress Codex - http://codex.wordpress.org/Using_Themes

WordPress › Featured « Free WordPress Themes - https://wordpress.org/themes/
 * WordPress › Pinnacle « Free WordPress Themes - https://wordpress.org/themes/pinnacle/

Installing and Activating Themes
Install files: cd wp-content/themes wget http://demo.oeey.com/themeforest-6200502-today-news-magazine-wordpress-theme.zip unzip themeforest-6200502-today-news-magazine-wordpress-theme.zip

Activate Theme: http://demo.oeey.com/wp-admin/themes.php

Only one theme may be active at a time.

Free Theme marketplaces

 * WordPress › Featured « Free WordPress Themes - https://wordpress.org/themes/
 * Free WordPress Themes for Blogs at WordPress.com - https://theme.wordpress.com/themes/sort/free/

Note: premium themes cost money

Themes I have used:
 * Misty Lake Theme - https://theme.wordpress.com/themes/misty-lake/

Pretty URLs with Permalinks
"By default WordPress uses web URLs which have question marks and lots of numbers in them; however, WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A number of tags are available, and here are some examples to get you started."

Permalinks are important for SEO and human readability.

Permalinks will change your URLs from this  to this.

Doc: http://codex.wordpress.org/Using_Permalinks

Admin URL: http://example.com/wp-admin/options-permalink.php

Common Settings Default 	http://example.com/?p=123 Day and name 	http://example.com/2015/02/12/sample-post/ Month and name 	http://example.com/2015/02/sample-post/ Numeric 	http://example.com/archives/123 Post name 	http://example.com/sample-post/

Custom Structure 	???

---

Example category/postname:

/%category%/%postname%/ /%category%/%postname%.html // static site version

Example - Post name:

Custom Structure: /%postname%/

Example - Category / Post Name:

Custom Structure: /%category%/%postname%/

---

Apache configuration:

.htaccess:  RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule. /index.php [L] 

Allow .htaccess in apache.conf: DocumentRoot /www/games-wp  AllowOverride All 

enable apache rewrite module: a2enmod rewrite

Disable Comments
Settings >> Discussion >> uncheck "Allow people to post comments on new articles"

This applies to new posts that you will publish from now on. To disallow comments from already publish posts:

Posts >> select them all and "Edit" under bulk actions and hit apply >> choose "do not allow" next to comments and hit update posts.

References:
 * WordPress › Support » turn off comments on pages by default - https://wordpress.org/support/topic/turn-off-comments-on-pages-by-default

Add Posts to Menu
"All you have to do is click "Screen Options" while viewing the "Custom Menu" manager and place a check beside "Posts" to show the elusive hidden "Posts" widget. Now you can add "Posts" to your custom menus"

Embed Widgets in Pages
Embed Widgets in Pages or Posts:
 * 1) Install and activate amr shortcode any widget plugin
 * 2) Add Widget to Shortcodes Sidebard (Appearance >> Widgets)
 * 3) Add shortcode tag within Page or Post

[do_widget calendar] [do_widget "recent posts"] [do_widget id=sticky-posts-2]

I find the "id=" to work the best, but hardest to find.

WordPress › amr shortcode any widget « WordPress Plugins - https://wordpress.org/plugins/amr-shortcode-any-widget/

References:
 * How to Add WordPress Widgets in Post and Page Content - http://www.wpbeginner.com/plugins/how-to-add-wordpress-widgets-in-post-and-page-content/

---

To debug:

"enter some garbage in the shortcode [do_widget wtf] and the plugin will offer you a try debug (if you are admin and logged in that is) Click on the "try debug""

or

"add ?do_widget_debug=1 to the url of the page that contains the [do_widget] shortcode."

WordPress › amr shortcode any widget - FAQ - https://wordpress.org/plugins/amr-shortcode-any-widget/faq/

Hide Widget Title

 * 1) Install and activate Remove Widget Titles plugin
 * 2) Add Exclamation (!) to front of Widget title

!Search

WordPress › Remove Widget Titles « WordPress Plugins - http://wordpress.org/extend/plugins/remove-widget-titles/

References:
 * How to Easily Hide Widget Title in WordPress - http://www.wpbeginner.com/plugins/how-to-easily-hide-widget-title-in-wordpress/

Categories for Pages
Plugin: (last updated 2014, 20K downloads) WordPress › Post Tags and Categories for Pages « WordPress Plugins - https://wordpress.org/plugins/post-tags-and-categories-for-pages/

Article:
 * Categories vs Tags - SEO Best Practices for Sorting your Content - http://www.wpbeginner.com/beginners-guide/categories-vs-tags-seo-best-practices-which-one-is-better/

---

Plugin: (last updated 2015, 2K downloads)
 * WordPress › Add Category to Pages « WordPress Plugins - https://wordpress.org/plugins/add-category-to-pages/

Article:
 * How to Add Categories and Tags to Pages in Wordpress - http://spicemailer.com/wordpress/add-categories-tags-pages-wordpress/