WP theming
todo; fill out, rearrange and link up
Templates
Adding styles and scripts
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); [1]
or ending;
, false, null);
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.
- Sidebar Widgets
- Navigation Menus
- Post Formats
- Post Thumbnails
- Custom Backgrounds
- Custom Headers
- Automatic Feed Links
- Editor Style
- How to leverage the Theme Customizer in your own themes - May 4, 2012
- http://codex.wordpress.org/Function_Reference/wp_nav_menu
- http://wordpress.stackexchange.com/questions/19245/any-docs-for-wp-nav-menus-items-wrap-argument
- http://themble.com/support/navigation-function/ - bones theme
- http://wordpress.stackexchange.com/questions/14037/menu-items-description-custom-walker-for-wp-nav-menu/14039#14039
- http://wordpress.org/support/topic/remove-the-div-and-ul-tags-from-wp_nav_menu-function
- http://www.newthinktank.com/2011/04/wp-nav-menu/
- http://techstudio.co/wordpress/configuring-custom-menus-in-a-wordpress-theme
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.
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
- A Sample WordPress Theme Options Page - June 3, 2010
- NHP-Theme-Options-Framework - extendable theme options classs, using Settings API. Custom error handling for validation classes, allows each tab to count its errors and display warnings for the user.
- Options Framework Plugin - originally via Thematic Options theme
- https://github.com/devinsays/options-framework-theme
- Options Framework Theme - newer plugin base starter theme
- Copy “options.php” from the Options Check theme into your own theme.
- Edit the array in “options.php” to define the options you want to use.
- 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; } } }
- The UpThemes Framework
- various things.
Preprocess
See also preprocess, sass.
Sass/SCSS
- Sass for Wordpress - 9 months ago
- requires ruby
- SASS for WordPress - December 7, 2011
- WordPress SASS - 2011-12-13
- 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
- LESS Compiler (wordpless) - This plugin compiles .less files in the active theme folder.
- http://plugins.trac.wordpress.org/browser/wordpless/
- README
- https://github.com/zsitro/WordpLESS
- lessphp v0.3.3, latest is 0.3.5
- WP-LESS - Implementation of LESS (Leaner CSS) in order to make themes development easier.
- uses lessphp v0.3.1, plugin-toolkit.
- http://wordpress.org/extend/plugins/lessjs/
- http://wordpress.org/extend/plugins/simple-less-for-wordpress/
- client side
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...
Process
- Use base theme
- HTML5
- Mobile first
- Make sure mobile devices don't get desktop size CSS or content
- 320 And Up
- If available, use server-side CSS preprocessing through theme or plugin.
- LESS and limited SCSS/Compass in PHP (all shared), full SCSS/etc. with Ruby (easier on VPS)
- Semantic CSS with grid and vertical rhythm systems
- Web fonts and icons
- Etc.
GUI
Testing
- http://wordpress.org/extend/plugins/theme-check/ - automatically check a theme against Theme Review guidelines
- Codex: Theme Unit Test
- Easier Theme Development with Sample WordPress Content - 1409 days ago
- http://wordpress.org/extend/plugins/monster-widget/ - add add widgets at once
Layout
- https://github.com/Automattic/table-of-contents - Adds a table of contents to your WordPress pages based on h3 and h4 tags. Useful for documention-centric sites.
- WordPress Content Widget - Display WordPress post/page content in a widget.
Sidebars
- http://codex.wordpress.org/Customizing_Your_Sidebar#New_way_of_adding_sidebars
- stackoverflow: Adding a 2nd Sidebar in a specific Wordpress theme
Excerpts
- http://wordpress.org/extend/plugins/advanced-recent-posts-widget/
- http://wordpress.org/extend/plugins/featured-page-widget/
Widgets
- http://wordpress.org/extend/plugins/featured-page-widget/ [2] - breaks external link output (even with a tag allowed). no support or development.
- http://wordpress.org/extend/plugins/page-on-widget/ - passes through images, ignores read more cut
- http://wordpress.org/extend/plugins/2046s-widget-loops/ - no excerpt length option
- http://wordpress.org/extend/plugins/page-in-widget/ - passes full page, 'show more link' no works.
- http://wordpress.org/extend/plugins/widget-custom/ - adds an extra sidebar, not widget?!?
- http://wordpress.org/extend/plugins/spectacula-page-widget - cannot alter excerpt length
- http://wordpress.org/extend/plugins/wp-page - cannot choose which tags to pass
- http://wordpress.org/extend/plugins/page-excerpts/ - doesn't actually give excerpt field or related widget..
- http://wordpress.org/extend/plugins/simple-page-widget/ - really basic, only option is page id
- http://wordpress.org/extend/plugins/post-and-page-excerpt-widgets/ - no length option, etc, broken plugin links
Template
not tried
- http://wordpress.org/extend/plugins/advanced-excerpt/ - excerpt without html stripped.
- http://wordpress.org/extend/plugins/multiple-content-blocks/
- http://wordpress.org/extend/plugins/custom-widget-area/ - no idea how this goes beyond adding a new sidebar the regular manner
- http://wordpress.org/extend/plugins/site-layout-customizer/ - alternate layouts. using a SHORTCODE?!
- http://wordpress.org/extend/plugins/wysiwyg-widgets
- http://wordpress.org/extend/plugins/custom-sidebars/ - page specific sidebars
- http://wordpress.org/extend/plugins/wordpress-countdown-widget/
- http://wordpress.org/extend/plugins/tumblr-widget-for-wordpress/
Typography
quick webfont plugin hack;
Performance
Minify; http://bit51.com/prepare-your-wordpress-theme-to-be-minified/