WordPress

From Things and Stuff Wiki
Jump to navigation Jump to search


todo; finish merging in two pages

General

  • WordPress Codex - The online manual for WordPress and a living repository for WordPress information and documentation.




Setup

wget http://wordpress.org/latest.tar.gz && tar -xvzf latest.tar.gz
&& mv wordpress domain.name && rm latest.tar.gz

or see WP Base

Nginx

todo, check, test and publish mine

rewrite (single);

Site Options

Can be set with wp-cli, i.e.;

wp option update siteurl 'http://127.0.0.1:8080'

Multisite (MU)

wp-config.php

define('WP_ALLOW_MULTISITE', true);

will enable the Tools Network Screen

  • choose subdirectory or subdomain
  • mkdir wp-content/blogs.dir
  • edit wp-config.php
  • make sure server rewrites are correct

Plugins

  • Bulk User Management - A WordPress plugin that lets you manage users across all your sites from one place on a multisite install. - very recent
  • Multisite Plugin Manager - Plugin management for WordPress Multisite that supports the native plugins page and the WPMU DEV Pro Sites plugin.
    • Select what plugins sites have access to
    • Choose plugins to Auto-Activate for all new blogs
    • Mass activate/deactivate a plugin on all sites in your network (Very Handy!)
    • Assign special plugin access permissions for specific sites in your network
    • And as Super Admin, you can override all these to activate specific plugins on the sites you choose!
    • Removes the plugin meta row links (Version, Author, Plugin) and any update messages for blog admins
  • Network Blog Manager aspire [sic] to be the perfect companion of every Super Administrator of a WP Blog's Network. Network blog internal search engine. - 2011-5-11
  • Plugin Commander is a plugin management plugin for multi-site mode, which allows further control on network-activated plugins. - 2010-9-1

S3

Management

Bedrock

Plugins

  • Jetpacl is a WordPress plugin that supercharges your self-hosted WordPress site with the awesome cloud power of WordPress.com.
  • TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install and even automatically activate plugins in singular or bulk fashion using native WordPress classes, functions and interfaces. You can reference pre-packaged plugins, plugins from the WordPress Plugin Repository or even plugins hosted elsewhere on the internet.
  • Plugin Dependencies - This meta-plugin allows regular plugins to specify other plugins that they depend upon.

Development

  • developer - from Automattic, helps optimize your development environment by making sure that you have all the essential tools and plugins installed.
    • Debug Bar Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
    • Debug Bar Cron
    • Rewrite Rules Inspector
    • Log Deprecated Notices
    • VIP Scanner
    • Monster Widget
    • Beta Tester
    • recommend wp-config.php set to true; WP_DEBUG, SAVEQUERIES
  • Plugin Test Drive lets you take any plugin for a test drive, see if suits your needs before letting your site visitors experience it.
  • WordPress Reset - Resets the WordPress database back to it's defaults. Deletes all customizations and content. Does not modify files only resets the database.
  • Show Template - Prints an html comment in the footer of every page letting you know which template file of your theme was used for the display.
  • Better Lorem Ipsum Generator - Auto-generate lorem ipsum content for all post types and taxonomies. Does comments as well. For theme and plugin developers.

Troubleshooting

Version control

Deployment

DB

  • HyperDB is an advanced database class that supports replication, failover, load balancing, and partitioning.
  • WP MySQL Console is a web shell to operate databases such as mysql command shell for developers. Its most original way to operate DBs, you should try. sounds hacky, badjudgement?

Coding

HTTP API

  • Codex: HTTP API - Within PHP, there are many possible ways to send an HTTP request. For simplicity, these methods will be referred to collectively as 'transports' for this article. The purpose for the HTTP API is to support as many of them as possible with an API that is simple and standard for each of the transports.

Composer

  • WordPress Packagist - This site provides a mirror of the WordPress plugin directory as a Composer repository.

Content

  • PressForward - a free plugin that provides an editorial workflow for content aggregation and curation within the WordPress dashboard. It is designed for bloggers and editorial teams who wish to collect, discuss, and share content from a variety of sources on the open web.

Pages

Posting

Post Extras

  • WP-Digest - Sends periodic email notifications of new WordPress blog entries (in either plain text or HTML mode) to a separate subscribers mailing list. Maintains cache file recording ID of last-sent post. On subsequent runs, sends all posts created since the previous run.
  • WP-ShkShell provides a terminal-like box for embedding terminal commands within pages or posts. It also support multi-lines, multi-commands and has syntax hightlight.
  • Shortcode Manager - Add javascript, iframes, php, flash, and other code to posts, pages, and widgets with ease.

Taxonomy

Relationships

Flickr

Countdown

todo

Comments

Templates

  • Templates
    • Stepping Into Templates - Introduction to the building blocks of WordPress Themes, the template files. Explains how they work together to build a web page and how template files can be included in other template files.
    • Template Hierarchy - Description of the order of preference of templates for the generation of various pages. Briefly lists the various templates that WordPress checks for in the process of generating a requested page on the weblog.

Template tags

wp_title()
wp_head()
wp_nav_menu()
<?php
 $defaults = array(
 	'theme_location'  => '',
 	'menu'            => '',
 	'container'       => 'div',
 	'container_class' => '',
 	'container_id'    => '',
 	'menu_class'      => 'menu',
 	'menu_id'         => '',
 	'echo'            => true,
 	'fallback_cb'     => 'wp_page_menu',
 	'before'          => '',
 	'after'           => '',
 	'link_before'     => '',
 	'link_after'      => '',
  	'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
 	'depth'           => 0,
 	'walker'          => ''
 );
 wp_nav_menu( $defaults );
 ?>

Tools

The Loop

Styles and scripts

wp_register_style( $handle, $src, $deps, $ver, $media )
wp_register_script( $handle, $src, $deps, $ver, $in_footer );

wp_enqueue_style( $handle, $src, $deps, $ver, $media );
wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );

Or wp_register_style/script with details then wp_enqueue_style on the registered item to choose when to load. Maybe wrapped up as a function and called with add_action

// Using your own version number: 1.1.0
wp_enqueue_style('my-stylesheet', 'url-to-stylesheet', array(), '1.1.0');
wp_enqueue_script('my-script', 'url-to-script', array(), '1.1.0');
// Using a NULL value to hide the version number completely
wp_enqueue_style('my-stylesheet', 'url-to-stylesheet', array(), NULL);
wp_enqueue_script('my-script', 'url-to-script', array(), NULL); [4]

or ending;

, false, null);

Header

  • http://codex.wordpress.org/Function_Reference/body_class - Themes have a template tag for the body tag which will help theme authors to style more effectively with CSS. The Template Tag is called body_class. This function gives the body element different classes and can be added, typically, in the header.php's HTML body tag.

Navigation menu

Does not kick in until Menu is created in Apperance > Menus and linked with appropriate theme menu area. If not set, falls back to showing all page links.

Sidebars

<?php $args = array(
   'name'          => sprintf(__('Sidebar %d'), $i ),
   'id'            => 'sidebar-$i',
   'description'   => '',
   'class'         => '',
   'before_widget' => '<li id="%1$s" class="widget %2$s">',
   'after_widget'  => '</li>',
   'before_title'  => '<h2 class="widgettitle">',
   'after_title'   => '</h2>' ); ?>

functions.php;

register_sidebar(array('name'=>'highlight'));

index.php, page.php, etc.;

get_sidebar('highlight');

Footer

Excerpts

Widgets

Template

Layout

not tried

Settings

Theme Features

  • Theme Features allows a theme to register support of a certain feature. Theme support functions should be called in the theme's functions.php file to work.

Settings API

  • Settings API - Allows admin pages containing settings forms to be managed semi-automatically. It lets you define settings pages, sections within those pages and fields within the sections.
    • Example given for choosing a background image.

Options API

  • Options API - a simple and standardized way of storing data in the database. The API makes it easy to create, access, update, and delete those options. All the data is being stored in the wp_options table under a given custom name. This page contains the technical documentation use the Options API.

Theme Options

  1. Copy “options.php” from the Options Check theme into your own theme.
  2. Edit the array in “options.php” to define the options you want to use.
  3. Add the following function to your theme so it will use default settings even if the Options Framework plugin is not installed:
/*
* Helper function to return the theme option value. If no value has been saved, it returns $default.
* Needed because options are saved as serialized strings.
*
* This code allows the theme to work without errors if the Options Framework plugin has been disabled.
*/
if ( !function_exists( 'of_get_option' ) ) {
function of_get_option($name, $default = false) {
   $optionsframework_settings = get_option('optionsframework');
   // Gets the unique option id
   $option_name = $optionsframework_settings['id'];
   if ( get_option($option_name) ) {
       $options = get_option($option_name);
   }
   if ( isset($options[$name]) ) {
       return $options[$name];
   } else {
       return $default;
   }
 }
}

Preprocess

See also preprocess, sass.

Sass/SCSS

functions.php;

// SASS/SCSS Stylesheet Definition  
function generate_css() {  
    if(function_exists('wpsass_define_stylesheet')) {  
        wpsass_define_stylesheet("mystyle.scss");  
    }  
}  
add_action( 'after_setup_theme', 'generate_css' );  
  • wp-sass - This plugin allows you to write and edit .sass and .scss files directly and have WordPress do the job of compiling and caching the resulting CSS. It eliminates the extra step of having to compile the files into CSS yourself before deploying them.
    • uses phpsass

install;

git clone git://github.com/sanchothefat/wp-sass.git wp-sass
git submodule update --init --recursive

functions.php:

<?php

// Include the class (unless you are using the script as a plugin)
require_once( 'wp-sass/wp-sass.php' );

// enqueue a .scss style sheet
if ( ! is_admin() )
   wp_enqueue_style( 'style', get_stylesheet_directory_uri() . '/style.scss' );
else
   wp_enqueue_style( 'admin', get_stylesheet_directory_uri() . '/admin.sass.php' );

// you can also use .scss files as mce editor style sheets
add_editor_style( 'editor-style.scss' );

?>

You can also create .sass.php or .scss.php files that will be preprocessed in the WordPress context. What this means is that you can use WordPress functions within the stylesheets themselves eg:

$red: <?php echo get_option( 'redcolour', '#c00' ); ?>;

body {
  background: $red;
}

LESS

  • WP-LESS - Implementation of LESS (Leaner CSS) in order to make themes development easier.
    • uses lessphp v0.3.1, plugin-toolkit.

Process, etc.

  • Theme Review - Guidelines for designing and developing WordPress Themes plus WordPress Theme Directory standards and practices.

Theme customizer in 3.4 - still need to grok relation to Settings API, etc...

GUI

Admin

Testing

Typography

Admin

  • ManageWP Worker allows you to remotely manage your WordPress sites from one dashboard. - 2012-6-28
    • Secure and fast solution for managing your WordPress sites
    • One click upgrades for WordPress, plugin and themes across all your sites
    • Schedule automatic backups of your websites (Amazon S3 and Dropbox supported)
    • One click to access WP admin of any site
    • Install WordPress, clone or migrate a website to another domain
    • Bulk install themes and plugins to multiple sites at once
    • Add sub-users (writers, staff..) to your account
    • Bulk publish posts to multiple sites at once
    • SEO Statistics, track your keyword rankings
    • Uptime monitoring
  • Core Control is a set of plugin modules which can be used to control certain aspects of the WordPress control. Currently, Core Control features modules for managing Filesystem Access, Managing plugin/theme/core updates, Managing HTTP Transports & External HTTP Request logging - 2011-7-12

Maintenance mode

Migration

Guides

WordPress.com

Plugins

Scripts

Backup


Users

robots.txt

WordPress generates on if there isn't one there. Confusion out there over what is best. to update

Security

Guides

Articles

Plugins

Tools

sudo apt-get install libcurl4-gnutls-dev libopenssl-ruby
sudo gem install typhoeus nokogiri json

Performance

Minify;

Static

  • https://github.com/leonstafford/wp2static - plugin to generate a static copy of your site and deploy to GitHub Pages, S3, Netlify, etc. Increase security, pageload speed and hosting options. Connect WordPress into your CI/CD workflow.



Cache

Minify

Guides

CDN

E-mail and subscription

E-commerce

WooCommerce

Theming

Hooks

Plugins

wp-e-commerce

Other

cloud backed plugins avoided

Social

  • Social is a lightweight plugin that handles a lot of the heavy lifting of making your blog seamlessly integrate with social networking sites Twitter and Facebook.

Links

Profile

Outbound

Inbound

Sharing

to sort

Authentication

Contact

Semantic

SEO

Analytics

Fun

Other

Documentation