WordPress Tavern: Searching Only The Codex

May 16th, 2012

When performing a search on the Codex, you’re presented with a slew of search results. However, not all of those results are within the Codex. The search portion of the Codex is powered by a Google custom search box which not only presents results from within the Codex, but from across WordPress.org as well, mainly the support forum.

Searching The Codex

While performing a search for Conditional Statements, the first result was the one I was looking for. However, if you want the results to strictly be within the Codex, I came across this link shared by Otto on the Documentation mailing list. While giving this method of searching the Codex a try, I found it difficult to find the Conditional Statements page I was looking for that was easily displayed by the Google Custom Search box. Even by checking each box, I failed at finding the page using both Conditional Statements and Conditional as my search terms.

My advice, stick to using the Search box that exists on the Codex page.

No related posts.


Holy Shmoly!: Fatal error: Allowed memory size of 67108864 bytes exhausted

May 16th, 2012

WordPress uses memory. Plugins and themes use memory. New versions of software may use more memory than before. When that happens and PHP on your server doesn’t have enough memory then PHP will stop with a fatal error like this:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 1203208 bytes) in /home/*****/public_html/wp-admin/includes/class-pclzip.php on line 4215

This happens quite a bit but it’s not a bug in WordPress or your new plugin or theme, you simply need to let PHP use more memory on your server. Thankfully WordPress makes it easy to do this. You must define a constant, WP_MEMORY_LIMIT in your server’s wp-config.php like this:

define(‘WP_MEMORY_LIMIT’, ’128M’);

The error message will give you an idea of how much memory is required. The error message says it tried to allocate 1203208 bytes or just over 1MB of memory. The limit here is 67108864 bytes, or 65536KB which is 64MB so here I’d need a WP_MEMORY_LIMIT of more than 66M. The error message will go away once PHP has enough memory but be sure to test it.

If you allocate too much memory your server could start eating into disk swap space. Also be aware that each Apache child process is allowed to use that much memory so if you had ten processes it could use ten times the memory limit in a worst case scenario. If that happens you’ll need more RAM or you’ll have to figure out what’s using so much memory.

There’s also a WP_MAX_MEMORY_LIMIT constant. By default it’s 256M and it’s currently only used when uploading images.

On the off chance that you don’t have WordPress installed and you came here from a search engine, then you’ll want to use ini_set() somewhere early in the PHP process to increase the memory limit:

ini_set(‘memory_limit’, ’128M’);

Finally, I love that the wp-config.php codex page is the first result of a search for WP_MEMORY_LIMIT.

Related Posts


WP Engineer: WordPress Options Passed To JavaScript #1

May 16th, 2012

In WordPress you are not always in the PHP world and so you have to pass settings and data from the database to scripts sometimes. In many Plugins you can find solutions in loading the wp-load.php and therefore access to all features of WordPress. Long ago Otto (Samuel Wood) already referred to this fact and this articles shows solutions. Questions still there and still there are Plugins that load the wp-load.php precisely because of such problems.

A similar problem arises when the source of the scripts is not just written in the footer area of WordPress, but outsourced to a file and via wp_enqueue_script() included. Only then WordPress can manage, compromises and optimizes these scripts for delivery. Therefore I would like to show two examples, how to pass data from PHP to JS.

The first snippet uses the pass of values ​​via JSON to get the values ​​from the database with the current resources in PHP and the script stores directly in the header of the page the values ​​as an object.

add_action( 'admin_enqueue_scripts', 'fb_print_scripts' );

function fb_print_scripts() {
	global $current_screen;

	if ( isset( $current_screen -> id ) && ! in_array( $current_screen -> id, array( 'post', 'page' ) ) )
		return;

	if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) )
		$options = get_site_option( 'my_options_id' );
	else
		$options = get_option( 'my_options_id' );

	if ( ! $options )
		return;
	?>
	<script type="text/javascript">
		var my_json_object = <?php echo json_encode( $options ); ?>;
	</script>
	<?php
}

The above function gives the values ​​from the database as a JSON object in the head of the backend, as the page was requested in the first step of the function. Via $current_screen it will be checked so it will be only delivered if you are on one of the defined pages (post, page).

The next step is common practice and best solution to include scripts in WordPress. Thereby I will include the JS file, which then has accesses to the JSON object.

add_action( 'admin_enqueue_scripts', 'fb_admin_enqueue_scripts' );

function fb_admin_enqueue_scripts( $where ) {

	if ( ! in_array( $where, array( 'post.php', 'post-new.php', ) )
		return;

	$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';

	wp_enqueue_script(
		self :: get_textdomain() . '_script',
		plugins_url( '/js/my_script' . $suffix. '.js', __FILE__ ),
		array( 'jquery', 'my_other_script' ),
		'',
		TRUE
	);

}

The script accesses directly the object that is processed.

jQuery( document ).ready( function( $ ) {

	if ( typeof my_json_object == 'undefined' )
		return;

// debug in console of Browser
console.dir( my_json_object ); 

});

Another solution will be presented in the following post at this series.


WordPress Snippet Plugin Xtreme One WordPress Framework
© WP Engineer Team, All rights reserved (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)


WordPress.com News: Stay In The Conversation

May 15th, 2012

It’s now much easier for you and your commenters to keep track of the conversations you’re involved in across WordPress.com. Some recent tests have shown that by subscribing commenters to new comments by default, they are more likely to stay engaged and come back and comment more on your blog. With that knowledge, we’ve changed the default comment following behavior to help you get more conversations going on your blog.

We made the initial changes last week and after great feedback from you we just launched an update. Here’s how it works:

  • By default, posting a comment will now subscribe you to receive follow-up comments via email for that specific post, keeping you updated on the conversation. This is indicated by the checked box in the comment form.
  • If you have a WordPress.com account, you now have a global setting to change this so that by default you will not be subscribed. If you don’t have an account, then you can create one over here.
  • If you don’t want email notifications for a thread, just uncheck the box when you post your comment. If you’ve disabled the feature, you can also subscribe to a specific thread by checking the box in the comment form.
  • There is also a link at the bottom of every notification email that will allow you to change your subscription options.

If you’d like to find out all of the details about how this works, we’ve also updated our support documentation about following comments.



Mark on WordPress: How I built “Have Baby. Need Stuff!”

May 15th, 2012

Have Baby. Need Stuff! is a baby gear site that my wife and I just launched. I thought I’d share how I built it.

WordPress Core

WordPress is a Git submodule, with the content directory moved to the /content/ directory. This makes my Git repo smaller, as WordPress isn’t actually in it.

Underscores

For a theme base, I started with the Underscores starter theme by the theme team at Automattic. Underscores is not a theme itself… it’s a starting point for building your own theme.

Bootstrap

Next, I integrated Bootstrap, by Twitter, to handle the CSS base and the grid system. Bootstrap is a really powerful framework, and version 2.0 has great responsive design support, which allowed me to create a single design that scales up to big screens or down to tablet or phone screen sizes. Try resizing it in your browser to see the responsiveness in action!

The CSS for the site is authored using LESS, which plays well with Bootstrap. I’m compiling/minifying/concatenating the CSS and JS using CodeKit, an amazing Mac OS X app that makes development a breeze.

Typekit

For web fonts, it’s hard to beat Typekit.

Subtle Patterns

I needed some patterns to use on the site, but I was frustrated with the licensing terms on many pattern sites I was finding. And then I found Subtle Patterns. Gorgeous, subtle patterns, liberally licensed. And hey, their site is WordPress powered too!

Posts 2 Posts

The site has the concepts of Departments, Needs, and Products. Each Department has multiple Needs. Each Need has multiple Products. I used Scribu’s phenomenal Posts 2 Posts plugin to handle these relationships.

Here’s the basic Posts 2 Posts connection code:

<?php

function hbns_register_p2p_relationships() {
	if ( !function_exists( 'p2p_register_connection_type' ) )
		return;

	// Connect Departments to Needs
	p2p_register_connection_type( array(
		'name' => 'departments_to_needs',
		'from' => 'department',
		'to' => 'need',
		'sortable' => 'to',
		'admin_box' => 'to',
		'admin_column' => 'any',
		'cardinality' => 'one-to-many',
	) );

	// Connect Needs to Products
	p2p_register_connection_type( array(
		'name' => 'needs_to_products',
		'from' => 'need',
		'to' => 'product',
		'sortable' => 'from',
		'admin_column' => 'any',
		'admin_box' => array(
			'show' => 'any',
			'context' => 'advanced',
		),
		'cardinality' => 'many-to-many',
		'fields' => array(
			'description' => 'Description',
		),
	) );
}

add_action( 'wp_loaded', 'hbns_register_p2p_relationships' );

I created a Custom Post Type for each of Departments, Needs, and Products, and connected them all using Posts 2 Posts. The connection between a Need and a Product also contains description metadata, as seen here:

Since Posts 2 Posts was a required plugin for the site to function, I didn’t want there to be any possibility of accidental deactivation. So I wrote a quick mu-plugins drop-in to “lock” certain plugins on.

<?php
class HBNS_Always_Active_Plugins {
	static $instance;
	private $always_active_plugins;

	function __construct() {
		$this->always_active_plugins = array(
			'batcache/batcache.php',
			'posts-to-posts/posts-to-posts.php',
			'login-logo/login-logo.php',
			'manual-control/manual-control.php',
		);
		foreach ( $this->always_active_plugins as $p ) {
			add_filter( 'plugin_action_links_' . plugin_basename( $p ), array( $this, 'remove_deactivation_link' ) );
		}
		add_filter( 'option_active_plugins', array( $this, 'active_plugins' ) );
	}

	function remove_deactivation_link( $actions ) {
		unset( $actions['deactivate'] );
		return $actions;
	}

	function active_plugins( $plugins ) {
		foreach ( $this->always_active_plugins as $p ) {
			if ( !array_search( $p, $plugins ) )
				$plugins[] = $p;
		}
		return $plugins;
	}
}

new HBNS_Always_Active_Plugins;

Custom Post Types

I’m using the Products post type in a slightly odd way. You don’t ever go to a product URL. You instead go the URL for the Need that the Product fulfills, and that page lists all of the connected Products. As such, I wanted to make it so that URLs for products pointed to their Need, and I wanted to add an admin bar Edit link for the primary product on its Need page.


<?php
/*
Plugin Name: Post Links
Version: 0.1
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/

// Convenience methods
if(!class_exists('CWS_Plugin_v2')){class CWS_Plugin_v2{function hook($h){$p=10;$m=$this->sanitize_method($h);$b=func_get_args();unset($b[0]);foreach((array)$b as $a){if(is_int($a))$p=$a;else $m=$a;}return add_action($h,array($this,$m),$p,999);}private function sanitize_method($m){return str_replace(array('.','-'),array('_DOT_','_DASH_'),$m);}}}

// The plugin
class CWS_HBNS_Post_Links_Plugin extends CWS_Plugin_v2 {
	public static $instance;

	public function __construct() {
		self::$instance = $this;
		$this->hook( 'plugins_loaded' );
	}

	public function plugins_loaded() {
		$this->hook( 'post_type_link' );
		$this->hook( 'add_admin_bar_menus' );
	}

	public function add_admin_bar_menus() {
		$this->hook( 'admin_bar_menu', 81 );
	}

	public function admin_bar_menu( $bar ) {
		if ( is_single() && 'need' == get_queried_object()->post_type ) {
			$primary_product = new WP_Query( array(
				'connected_type' => 'needs_to_products',
				'connected_items' => get_queried_object(),
			) );
			if ( $primary_product->have_posts() ) {
				$bar->add_menu( array(
					'id' => 'edit-primary-product',
					'title' => 'Edit Primary Product',
					'href' => get_edit_post_link( $primary_product->posts[0] ),
				) );
			}
		}
	}

	public function post_type_link( $link, $post ) {
		switch ( $post->post_type ) {
			case 'product' :
				$need = new WP_Query( array(
					'connected_type' => 'needs_to_products',
					'connected_items' => $post,
				) );
				if ( $need->have_posts() )
					return get_permalink( $need->posts[0] );
				break;
		}
		return $link;
	}
}

new CWS_HBNS_Post_Links_Plugin;

For entering data about Products, I made a custom Meta Box that provided a simple interface for entering the Amazon.com link, the approximate price, and then a freeform textarea for key/value pairs and miscellaneous bullet points.

Misc

Because I’m using a Git-backed and Capistrano-deployed repo, I don’t want any local file editing. So I dropped this code in:


<?php

define( 'DISALLOW_FILE_EDIT', true );

function hbns_disable_plugin_deletion( $actions ) {
	unset( $actions['delete'] );
	return $actions;
}

add_action( 'plugin_action_links', 'hbns_disable_plugin_deletion' );

I was playing a lot with different Product thumbnail sizes, so Viper007Bond’s Regenerate Thumbnails plugin was invaluable, for going back and reprocessing the images I’d uploaded.

And of course, no WordPress developer should make a site without Debug Bar and Debug Bar Console.

Nginx and PHP-FPM

My server runs Nginx and PHP-FPM, in lieu of Apache and mod_php. My normal setup is to use Batcache with an APC backend to do HTML output caching, but I also have an Nginx “microcache” that caches anonymous page views for a short amount of time (5 seconds). But with this site, I wanted to cache more aggressively. Because there are no comments, the site’s content remains static unless we change it. So I cranked my microcache up to 10 minutes (I guess it’s not a microcache anymore!). But I wanted a way to purge the cache if a Product or Post was updated, without having to wait up to 10 minutes. So I modified the Nginx config to recognize a special header that would force a dynamic page load, effectively updating the cache.

Here’s the relevant part of the Nginx config:

	location ~ \.php$ {
		# Set some proxy cache stuff
		fastcgi_cache microcache_fpm;
		fastcgi_cache_key $scheme$host$request_method$request_uri;
		fastcgi_cache_valid 200 304 10m;
		fastcgi_cache_use_stale updating;
		fastcgi_max_temp_file_size 1M;

		set $no_cache_set  0;
		set $no_cache_get  0;

		if ( $http_cookie ~* "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) {
			set $no_cache_set 1;
			set $no_cache_get 1;
		}

		# If a request comes in with a X-Nginx-Cache-Purge: 1 header, do not grab from cache
		# But note that we will still store to cache
		# We use this to proactively update items in the cache!
		if ( $http_x_nginx_cache_purge ) {
			set $no_cache_get 1;
		}

		# For cached requests, tell client to hang on to them for 5 minutes
		if ( $no_cache_set = 0 ) {
		        expires 5m;
		}

		# fastcgi_no_cache means "Do not store this proxy response in the cache"
		fastcgi_no_cache $no_cache_set;
		# fastcgi_cache_bypass means "Do not look in the cache for this request"
		fastcgi_cache_bypass $no_cache_get;

		include        /etc/nginx/fastcgi_params;
		fastcgi_index  index.php;
		try_files      $uri =404;

		fastcgi_pass phpfpm;
	}

Now I just needed to have WordPress ping those URLs with that header to refresh them when something changed. Here’s the “meat” of that code:

<?php
	public function transition_post_status( $new, $old, $post ) {
		if ( 'publish' !== $old && 'publish' !== $new )
			return;
		$post = get_post( $post );
		$url = get_permalink( $post );

		// Purge this URL
		$this->purge( $url );

		// Purge the front page
		$this->purge( home_url( '/' ) );

		// If a Product changes, flush its Need and that Need's Department
		if ( 'product' === $post->post_type ) {
			// Flush the connected need
			$need = new WP_Query( array(
				'connected_type' => 'needs_to_products',
				'connected_items' => $post,
			) );
			if ( $need->have_posts() ) {
				$this->purge( get_permalink( $need->posts[0] ) );
				// Now this need's connected Department
				$department = new WP_Query( array(
					'connected_type' => 'departments_to_needs',
					'connected_items' => $need->posts[0],
				) );
				if ( $department->have_posts() )
					$this->purge( get_permalink( $department->posts[0] ) );
			}
		// If a Post changes, flush the main Blog page
		} elseif ( 'post' === $post->post_type ) {
			$this->purge( home_url( '/blog/' ) );
		}
	}

	private function purge( $url ) {
		wp_remote_get( $url, array( 'timeout' => 0.01, 'blocking' => false, 'headers' => array( 'X-Nginx-Cache-Purge' => '1' ) ) );
	}

Boom. Now I get the benefit of long cache times, but with the ability to have updates go live quickly when I need to. The upshot here is that while I have Batcache installed, it’s not really going to get a lot of use, as the outer Nginx caching layer should handle everything. This doesn’t just mean that the site scales (Apache Bench has it handling many thousands of requests a second with ease), but that the site is really, really fast to browse. Your experience will vary according to network and geography, of course. But for me, I’m getting 34ms HTML delivery times for pages in the Nginx cache.

Questions?

So that’s how I did it. Let me know if you have any questions!



WordPress.com News: Look at These Gorgeous Blogs

May 15th, 2012

We’ve added a user showcase where you can view stunning customizations made by people just like you. From complete redesigns with CSS to adding pizzazz with Custom Fonts to clever use of options like background and header, this showcase will spark your imagination and inspire creativity.

Discover details about what each showcase blog is doing with WordPress.com themes and customizations by clicking a thumbnail to see a colophon-style list of credits on the left.

Colophon-style Credits on WordPress.com

We’ve also updated footer links so blog owners can show off the types of customizations they’ve made and visitors can learn more by clicking the “Customized” link in WordPress.com footers. A “Customized” link will appear next to the theme name for blogs that are using Custom Design tools like fonts or CSS.

WordPress.com Footer Credits Link

Things we like to see when looking for showcase-worthy customizations are blogs with good traffic, beautiful design, well-written articles or stunning images, recent content updates, and involvement helping out in our CSS Customization forum.

Be inspired, customize your blog and make it that perfect place for your creations.



WordPress.com News: Photo Blogging 101, Part 1

May 14th, 2012

Spring is in the air. With the weather warming up, now is a great time to get started on a photo blog. Creating a photo blog is a wonderful introduction to blogging on WordPress.com or an opportunity to refresh your current site. Ready to get started? You can sign up for a new blog right over here.

Getting started

Photo blogs, sometimes called phlogs, use pictures instead of words. While many photo bloggers choose a type of photo that they want to focus on, such as portraits, others use their photo blog to document their life’s events. Photo blogs come in a variety of styles, including those that focus on vacation photos or even snapshots of friends. With images, we can capture moments in our life in a way that sometimes words cannot.

When starting a photo blog, you’ll want to choose a theme with a wider content area to help to showcase your photos at full size. Similarly, choosing a theme that is minimalistic helps to reduce any noise that may detract from the focus on your photography. Popular photo blogging themes on WordPress.com include Nishita, Duotone, and Modularity Lite. Looking for some inspiration? Be sure to check out the photo blogs below or more of our recommended photo blogging sites for examples of photo-friendly layouts.

The Unknown Project, a WordPress.com photo blog using Anthem.

Tracey Capone Photography, a WordPress.com photo blog using Twenty Eleven.

Tomorrow Never Knows, a WordPress.com photo blog using Comet.

Want to add photo flair to your site without starting a whole new blog? Adding a photo blogging category to an existing blog is a great way to revamp your site. In fact, you may consider doing “Friday Phlogs” or a similar weekly special to help incorporate these tips consistently into your current site.

Tools of the Trade

What do you need to get started? Nothing but a camera and an internet connection. Photo blogging with a smart phone is growing increasingly simple, particularly with the Quick Photo button in the WordPress for iOS and Android apps where you can point, shoot, and publish. If you’re already a pro at the WordPress apps, you may be interested in taking a look at Camera+ and Flickr, which allow you to automatically share your photos to your WordPress.com blog.

On the left, QuickPhoto in WordPress for Android and on the right, QuickPhoto in WordPress for iOS.

If you choose to use a more traditional camera, there are few tips to keep in mind when uploading your photos to ensure they represent the full quality of your original picture.

  • Don’t resize your photos after uploading them to WordPress.com. Instead, leave your images at full size so we can see your work in all of it’s glory. WordPress.com will automatically generate the appropriate dimensions for you.
  • Make edits to your photos before uploading them.
  • Save your photos as JPEGs. JPEGs are the best format for photos online. You can also use PNG if you’re looking to add a transparent image to your site.

Welcome to our series on photo blogging! Stay tuned for more tips and tricks over the next few weeks.



WordPress Tavern: My Apologies To The WordPress Foundation

May 12th, 2012

First off, I want to offer my sincere apologies to the WordPress Foundation. In a previous article, I incorrectly labeled the foundation as harming WordCamps. My main gripe was with the fact that some WordCamp organizers were being denied the ability to have high sponsorship caps and thus, it sometimes adversely affected the event either in terms of it’s size or type of venue they could hold the event in. As time has gone by, I’ve learned that the biggest mistake I made was contributing the organizing and running of WordCamps to the WordPress Foundation which is incorrect. WordCamp Central is the group responsible for all things WordCamp related while the WordPress Foundation oversees the use of the WordPress and WordCamp trademarks. Unfortunately in the original discussion, WordCamp Central and the WordPress Foundation were used interchangeably which muddied the conversation.

Perhaps I should have known better, but even though I’ve been apart of the WordPress community for two years, the project has grown far beyond just being publishing software. There is the foundation, WordCamp Central, Automattic, WordPress.com, various Automattic owned services, Audrey.co, etc. It’s hard to place blame or hold anyone accountable when you have no idea who that person is or what project or group they belong to. It’s frustrating for me but I wonder if many people simply don’t care, just as long as WordPress remains awesome, easy to use publishing software? I’ve often felt that there should be some sort of WordPress White Pages so that the public can know who is responsible for what within the WordPress project. But since so many individuals mingle with various parts, that project would soon be a waste of time.

P.S. There is hope for things to change for the better.

Related posts:

  1. WordPress Foundation To Foot The Bill For Meetup.com Organizer Dues
  2. Virtual WordCamp Virtually Disappears
  3. All We Want To Know Is Why?


Holy Shmoly!: Super Cache for the Weekend

May 11th, 2012

WP Super Cache 1.0 came out several months ago and while it worked fine for most people there’s always room for improvement and bug fixes. Here are some of the bug fixes and improvements coming in the next version which I plan on releasing next week.

There are a lot of changes there so if you have a self hosted blog I would really appreciate if you download the development version, wp-super-cache.zip and install it in your plugins folder.

  • Use $_SERVER[ 'SERVER_NAME' ] to create cache directories.
  • Only create blogs cached directories if valid requests and blogs exist.
  • Only clear current blog’s cache files if navigation menu is modified
  • Added clean_post_cache action to clear cache on post actions
  • Removed garbage collection details on Contents tab
  • Added wp_cache_check_mobile cacheaction filter to shortcircuit mobile device check.
  • Don’t delete cache files for draft posts
  • Added action on wp_trash_post to clear the cache when trashed posts are deleted
  • Show a warning when 304 browser caching is disabled (because mod_rewrite caching is on)
  • New check for safe mode if using less that PHP 5.3.0
  • Added wp_supercache_remove_cookies filter to disable anonymous browsing mode.
  • Fixed garbage collection schedule dropdown
  • Fixed preload problem clearing site’s cache on “page on front” sites.
  • Fix for PHP variable not defined warnings
  • Fixed problem refreshing cache when comments made as siteurl() sometimes didn’t work
  • Preloading of taxonomies is now optional
  • Domain mapping fixes.
  • Better support for https sites. Remove https:// to get cache paths.
  • Added AddDefaultCharset .htaccess rule back in and added an option to remove it if required.
  • Added multisite plugin that adds a “Cached” column to Network->Sites to disable caching on a per site basis.
  • Added WPTouch plugin to modify browser and prefix list in mobile detection code. Added support for that plugin’s exclude list.
  • Fixed cache tester
  • Filter the tags that are used to detect end-of-page using the wp_cache_eof_tags filter.

Related Posts


Konstantin Kovshenin: Quick tip: Hide the Home Item on Your Front Page in WordPress

May 11th, 2012

The title says it all — this one-liner CSS will hide the home item from your navigation menu, when you’re on the home page:

body.home .current-menu-item { display: none; }

If you’re not yet using wp_nav_menu to build your navigation menus, then, uhm, wake up! Also, the snippet relies on the body_class usage in your theme, and if your theme doesn’t use one, uhm, wake up! :)

I also want to avoid the discussion about how the primary navigation should be consistent through each and every page on the website, if at all possible :)


Lorelle on WordPress News: Do Not Delete Comment Spam. Mark Spam as Spam.

May 10th, 2012
Is comment spam one of the things that gets you down? Are you taking it personally? Are you confused by comment spam and how to handle it? I’ve been speaking at a variety of meetups lately on web publishing, blogging, and podcasting, and the topics often turn to managing comments and comment spam. “I’ve started [...]

Benjamin J. Balter: Free Yourself from the Tyranny of Sharepoint

May 10th, 2012

Sharepoint is a plague upon the American workforce. This ubiquitous piece of collaboration software has taught millions of people that Intranets are destined to be places where you can’t find anything[, but it] doesn’t have to be this way, despite what Microsoft may have you believe.”

- Joe Flood on Freeing Yourself from the Tyranny of Sharepoint

Continue reading Free Yourself from the Tyranny of Sharepoint by Benjamin J. Balter

Related posts:

  1. WP Document Revisions — Document Management & Version Control for WordPress
  2. WordPress as a Collaboration Platform
  3. WordPress for Government – A Problem of Perception


Brad Williams Blog: WP Late Night Becomes Most Popular WordPress Podcast!

May 10th, 2012

It’s has been confirmed that WP Late Night, the new podcast I’m a Co-Host on, has become the #1 WordPress Podcast! I’m really excited, especially since we are just getting started. Last night we recorded the 8th episode of WP Late Night and are having a great time!

WP Late Night LogoWe’re trying to make this podcast different from the rest. We stream live video of the show using Spreecast. You can watch the video recording of our past shows on our WP Late Night Spreecast channel.

Another reason I think the show is so successful is the synergy between the hosts. I’ve known Ryan and Dre for a few years now. We’ve hung out at many WordCamps (and after parties!) and have become really good friends. Being friends with your co-hosts makes a big difference in the harmony of the show and I think that really comes across in each episode.

If you haven’t tuned in yet I highly recommend you give us a spin. You can listen to all of our episodes by visiting WPLateNight.com. You can also catch us live every Wednesday @ 8pm EDT on the WPCandy.com Stream.

Related posts:

  1. New WordPress Podcast: WP Late Night Starts Tonight!
  2. SitePoint Podcast Wins Podcast of the Year Award!
  3. Matt Mullenweg LIVE on the WordPress Weekly Podcast Tonight!


WordPress.com News: New Themes: Just Desserts and Oxygen

May 10th, 2012

Happy Thursday! We’ve added some exciting new themes to our ever-growing collection, and we’re happy to tell you all about them.

First out of the oven is…Just Desserts. Yep, that’s a theme! Designed by Andy Rutledge, Just Desserts is a deliciously stylish premium theme that’s perfect for blogs centered on food.

Just Desserts

With its responsive, single-column layout and unique presentation of images and posts on the front page, Just Desserts gives you a delectable canvas on which your mouthwatering photos and text can really shine — even when viewed on smaller mobile devices such as tablets and smartphones.

There’s much more to be said about Just Desserts, and we’ve provided all of the tasty details on the Theme Showcase.

If all of the dessert goodness left you breathless, we can supply you with some…Oxygen. Yep, that’s also a theme. Although, it may also leave you breathless because it’s simply stunning.

Oxygen

Designed by DevPress, Oxygen is a minimal yet beautifully crafted free magazine theme. With the help of your amazing images, the crisp and well-balanced design will transform your blog into an online magazine that looks sharp and professional.

Oxygen contains many features and customization options, including a showcase page template with a featured slider, featured images, seven widget areas, and a carefully tailored responsive layout. To read about these features and more, you know where to head — the Theme Showcase.

Happy blogging! We look forward to seeing what you bake, photograph, and write, armed with these great new themes.



Konstantin Kovshenin: Rewrite Rules Inspector

May 9th, 2012

Rewrite Rules Inspector

Clients often ask for fuzzy, non-standard, maybe weird and not always logical permalink structure for their sites. If you’re now working with such a client, consider yourself lucky, because the brand new Rewrite Rules Inspector plugin is here! Props to the WordPress.com VIP team :)


Konstantin Kovshenin: How to leverage the Theme Customizer in your own themes

May 8th, 2012

How to leverage the Theme Customizer in your own themes by Otto Wood, who is a WordPress core developer. Get your theme ready for 3.4!


Benjamin J. Balter: WordPress as a Collaboration Platform

May 8th, 2012

Today countless teams are using WordPress to drive collaboration and facilitate inter-team communication. This presentation — given at the May WordPress DC Meetup — showcases some of the creative ways companies and organizations are using WordPress as the central hub of their day-to-day workflow: To organize and collaboratively edit documents and other non-web content, track and communicate their team’s progress with one another, and extend WordPress to work with their existing tools and practices

Click on the slides below to begin, then press the left/right keyboard arrows to navigate

 

Recording of the presentation (starts at the 10:00 mark):

Plugins Mentioned

Continue reading WordPress as a Collaboration Platform by Benjamin J. Balter

Related posts:

  1. WP Document Revisions — Document Management & Version Control for WordPress
  2. Advanced Workflow Management Tools for WP Document Revisions
  3. Free Yourself from the Tyranny of Sharepoint


Lorelle on WordPress News: WordCamp San Francisco August 4, 2012

May 8th, 2012
WordCamp San Francisco 2012 is set for August 4 this year at the Mission Bay Conference Center. A developer hack day is scheduled for August 5th, and a survey looking for the best WordCamp speakers is open for recommendations. I know it’s me, but who’s counting. Honestly, if you have attended a WordCamp in the [...]

WP Engineer: First or Last Page in Page-Structures of WordPress

May 8th, 2012

Now and then little snippets are pretty useful. For a fix in a Premium-Theme, I needed a kind of evaluation, where I am in the site structure and with little effort I was able to expand the classes and react with CSS.

The following code shows the basic for it and get_pages() is the key from the core of WordPress to get to these results. This function provides the necessary result of using the parameter and the output via the parameter sort_order provides the sequence and identification of the first page, which is then either the first or last page in this structure.

// First post in structure
// simple, but usefull ;)
global $post;

$page_childs = get_pages( 'child_of=' . $post->post_parent . '&sort_order=ASC' );
$first_child = $page_childs[0];

if ( get_the_ID() === (int) $first_child->ID )
 echo 'First Child';
// Last post in structure
global $post;

$page_childs = get_pages( 'child_of=' . $post->post_parent . '&sort_order=DESC' );
$last_child  = $page_childs[0];

if ( get_the_ID() === (int) $last_child->ID )
 echo 'Last Child';

WordPress Snippet Plugin Xtreme One WordPress Framework
© WP Engineer Team, All rights reserved (Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)


Quick Online Tips (QOT): Get Best WordPress.com Features in Self Hosted WordPress Blogs

May 6th, 2012

Home > Blogging > WordPress

Facebook Share Twitter Share

Did you know that you could get the best WordPress.com features in your self hosted WordPress blog just by adding a WordPress plug-in. WordPress.com has some amazing features which are missing in WordPress.org installations, and the Jetpack WordPress plugin is the best way to incorporate all these amazing features in your WordPress blog.

Firstly I was apprehensive to install this WordPress plugin, since it was a collection of multiple WordPress plug-ins in one large plugin  and I was concerned about the server load and how it would affect my site speed. I was using the WordPress stats plug-in for several years, and a large banner on top of my WordPress installation kept nagging me to upgrade to the new version which is available only in the JetPack.

JetPack WordPress Plugin

I have been a fan of several useful WordPress.com features lplugindPress stats, contact form, WordPress short links, subscriptions etc. so I decided to install Jet Pack and try out the new plug-in features. And to my surprise it was a collection of very powerful and useful features.

Jet Pack WordPress Plugin

  • Subscriptions – it enables your site visitors to subscribe to your posts and comments and get updates via e-mail. It proved a quick replacement to my earlier amazing subscribe to comments plug-in.
  • WordPress.com stats – I have been using this WordPress plug-in for several years and it provides a quick snapshot of your site statistics. Jet pack includes the latest version of this plug-in, and all future versions of the stats plug-in will now only be available through the Jet Pack. Of course now the data provided by the plug-in is much more detailed than before.
  • Spelling and grammar – helps to improve your writing by contextual spell checking, advanced style checking and intelligent grammar checking of your articles. It is powered by After the Deadline open source technology.
  • Social sharing – powered by ShareDaddy, this plug-in provides an array of custom social sharing buttons which are then placed beneath your articles and improve the social engagement of your visitors.
  • VaultPress – this is a useful WordPress backup plug-in which we have been using for several years and is a useful tool in case your WordPress database crashes or you need to restore your site. Read our VaultPress review about this real-time backup and security scanning plug-in. It is highly recommended.
  • Contact form – is a useful plug-in to insert a contact form on any page or post you like, and is a good replacement for any contact form WordPress plug-in you might be using.
  • Gravatar Hovercards – if you support Gravatar profiles in your comments, then this plug-in will show pop-up business cards of these users from their gravatar profiles.
  • WP.me short links – creates a short link for all your pages and posts which can be easily shared on social media sites like Twitter.
  • Short code embeds – allows you to use short codes to embed videos from YouTube, Vimeo, slide share etc.
  • Beautiful math – allows you to use specialised markup language to post complex maths equations.
  • Sidebar widgets – some new widgets appear in your WordPress blog which allow you to add images, Twitter updates and RSS feed links in your sidebar.
  • Enhanced distribution- allows better sharing of your post articles and comments in real-time by distributing them quickly to search engines. A good pinging tool.

At first I had difficulty in deciding which plug-ins I should use. I also found it difficult to deactivate a few plug-ins since they were all activated by default and I did not need all these features. I learnt that you need to click on “Learn more” button, to make the “Deactivate” button appear! Then I could choose which plug-ins I actually needed to use.

Right now I am using the Subscriptions, WordPress.com stats, spelling, Vaultpress, Contact form and Enhanced distribution. The main advantage is that this is created by Automattic, the official WordPress team, so it promises to be tightly integrated in your WordPress.org installation easily.

So if like me, you decide to use some of the amazing WordPress.com features on your WordPress.org blog, then try the JetPack plug-in and you will find it useful.

After reading this article, readers liked these articles

Original Article: Get Best WordPress.com Features in Self Hosted WordPress Blogs

Copyright 2012. Quick Online Tips. All Rights Reserved.


Otto on WordPress: How to leverage the Theme Customizer in your own themes

May 4th, 2012

Note: Everything I’m talking about here, including the code, is in beta mode. It will be subject to change. I’ll update this post after release to fix any code changes that may occur between now and then. I’m releasing this post now so that theme authors can start looking at their themes and thinking about how they might want to change the way they do options pages.

So, WordPress 3.4 has this nifty new feature you can find on the main Theme selection page. It’s a link next to each theme labeled “Customize”. This is the new Theme Customizer, and it’s way cool.

In fact, you can’t see what it does with a simple picture, so here’s a video. It’s available in HD if you want to go full screen. :)

So, now you know what it does, and if you’re a theme author, you’ve probably just gotten some great ideas. Here’s how you can implement those ideas in your theme.

First, note that if you already support the built in Custom Header and Custom Background functionality the WordPress core provides, then those will magically show up and work in the theme customizer. No extra code needed on your part.

Existing Options

Now, the first thing you’ll probably want to do is to take note of how your existing settings in the theme work. You have three main options for theme settings, realistically. I’ll go over them briefly.

1. “Theme mod”. This uses the set_theme_mod and get_theme_mod functions. It’s rare that themes actually use these since I wrote about the Settings API, but it is there and if you use these normally then it is supported by the Theme Customizer (in fact it’s the default).

2. Individual Settings. If you store your theme’s settings in the options table as individual rows, one per setting, then that works fine with the customizer. This is not the preferred way of doing things in themes, however, and not the most common. Still, some themes do this, so if you’re one of them, it’s supported as well.

3. Serialized Settings. This is the way I explained in my Settings API Tutorial and the method recommended by the Theme Review guidelines, as well as the way Chip described in his own tutorial for theme settings. Essentially, you store your settings in an array, then store that array using set_option or get_option, as one row in the database. This method is supported and it’s the way I’ll primarily cover in this article. I’ll briefly mention the other two methods when appropriate.

Once you know how your settings are stored, then you’ll know what to fill in at certain spots in the code. More on this when we get to it.

Object Orientation

Now, the Theme Customizer is very object oriented, and while you don’t necessarily need to understand this to implement the basics of it, you might need to understand it if you’re going to make something completely custom. Just a warning.

First, we’ll look at the left hand side of the customizer screen. Notice that the left hand side is divided into sections. Actually, that’s their name: WP_Customize_Section. In each of these sections is one or more controls; or rather, WP_Customize_Control. Finally, each of these controls one of more settings on the page: aka WP_Customize_Setting.

The Sections organize the controls. The Controls get input and pass it to the settings. The Settings interface with your existing options in the theme.

To make new stuff here for your own custom options, you need to know where to add it. That place is the customize_register action hook.

add_action( 'customize_register', 'themename_customize_register' );
function themename_customize_register($wp_customize) {
	// ... do stuff ...

The function gets a parameter of the main $wp_customize object. This is the interface point where you will do everything like adding sections and controls and such.

Sections

So, first thing to do is to add a section. Here’s one way to do it:

	$wp_customize->add_section( 'themename_color_scheme', array(
		'title'          => __( 'Color Scheme', 'themename' ),
		'priority'       => 35,
	) );

The first parameter is a unique ID for the section that you’ll need later (when you’re putting controls into it). The second parameter is an array of options for the section. Sections don’t have a lot of options, really. You can give them a title, you can give them a “description” if you need some explanatory text in them. The priority setting determines their order in the list.

You can also give sections a “capability” if you have a special case. Generally speaking, most sites require the “edit_theme_options” capability to have users edit this sort of thing, and this is the default capability that the sections use. However, if you have options that anybody can edit, or which should only be managed by administrators, changing this capability will prevent the section from appearing to users who can’t change those settings anyway.

One final thing you can add to a section is a “theme_supports” option. This will make the menu not appear unless the theme supports something. If you’re putting this code in a theme itself, then you already know what the theme supports, so it doesn’t make much sense. The core uses this to not show the header and background options if the theme doesn’t support them.

Settings

Next, let’s configure some settings. Yes, the settings, not the controls. See, the controls need to know what settings they’re changing, so we have to attach the settings up first.

To declare a setting, you do it like this:

	$wp_customize->add_setting( 'themename_theme_options[color_scheme]', array(
		'default'        => 'some-default-value',
		'type'           => 'option',
		'capability'     => 'edit_theme_options',
	) );

In this case, I’ve declared that the setting I’m interested in is in an option, the option is named “themename_theme_options” in the database, and it’s serialized, and the actual array key in there is “color_scheme”. Remember that talk we had before about the Settings API and how you store your settings? This was method 3.

Here’s method 2 (one option per database entry):

	$wp_customize->add_setting( 'themename_color_scheme', array(
		'default'        => 'some-default-value',
		'type'           => 'option',
		'capability'     => 'edit_theme_options',
	) );

And here’s method 1 (using theme_mod):

	$wp_customize->add_setting( 'color_scheme', array(
		'default'        => 'some-default-value',
		'type'           => 'theme_mod',
		'capability'     => 'edit_theme_options',
	) );

This setting basically tells the theme customizer where the option is stored, and how to change it’s value so that your theme displays with the changed option.

Here’s the good bit about this: You’re telling the theme customizer where the option is. You don’t have to change the way the existing option works at all.

You already have a theme options page, right? So somehow, you’re saving those options. And in the theme, it’s reading those options using get_theme_mod or get_option, right? The way the theme customizer works is that it intercepts that call using a filter, changes the option for the previewer case only, and then passes the new option along to the theme. So the theme has no idea that the value it’s getting isn’t in the database, but one the user just selected. That’s the magic trick and why themes don’t have to dramatically change to support this sort of thing. All they have to do to make custom sections is to tell the theme customizer code what options they’re using and how, and it changes those options directly for the previewer.

(Note of clarification here: The “default” setting above should be a default value, not the current value. The difference is a subtle one, but the point is that you don’t actually need to get the current value of the option from the DB and put it in here. The WP_Customize_Setting takes care of all that jazz for you. The “default” is what should be used if the value doesn’t exist in the DB at all.)

There’s one more bit to the add_setting call that we’ll come back to later when I get around to explaining postMessage.

Controls

Finally, we come to the controls. Controls can look one of a lot of ways, obviously. The simplest controls are just checkboxes, or text fields. However, colors are something that change a lot, so there’s color wheel controls too. In fact, WordPress defines a number of possible controls. Let’s go over a few:

A radio selection:

	$wp_customize->add_control( 'themename_color_scheme', array(
		'label'      => __( 'Color Scheme', 'themename' ),
		'section'    => 'themename_color_scheme',
		'settings'   => 'themename_theme_options[color_scheme]',
		'type'       => 'radio',
		'choices'    => array(
			'value1' => 'Choice 1',
			'value2' => 'Choice 2',
			'value3' => 'Choice 3',
			),
	) );

Pretty simple. It’s referencing the section it’s in, the setting that it’s going to change, and then it has the radio type and the list of choices along with their associated values.

How about a checkbox instead? This one comes straight from core:

	$wp_customize->add_control( 'display_header_text', array(
		'settings' => 'header_textcolor',
		'label'    => __( 'Display Header Text' ),
		'section'  => 'header',
		'type'     => 'checkbox',
	) );

A checkbox is on or off, true or false. It needs no real values.

How about a selection dropdown box? Here’s an example:

	$wp_customize->add_control( 'example_select_box', array(
		'label'   => 'Select Something:',
		'section' => 'nav',
		'type'    => 'select',
		'choices'    => array(
			'value1' => 'Choice 1',
			'value2' => 'Choice 2',
			'value3' => 'Choice 3',
			),
	) );

The default type of control is actually type = ‘text’, and it creates a text box control. One more type of control is the “dropdown-pages” type, which creates a dropdown list of the WordPress Pages.

But that’s not all. There’s actually several more, but because they’re so custom, they’re declared differently. Here’s where we get all object oriented on ya…

	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array(
		'label'   => __( 'Link Color', 'themename' ),
		'section' => 'themename_color_scheme',
		'settings'   => 'themename_theme_options[link_color]',
	) ) );

Whoa, what’s with the new class? The WP_Customize_Color_Control is a class that is extending the built in WP_Customize_Control class. It adds the color wheel jazz to places where color selection is needed. Note that the class is being created here with new, and so it has to get the $wp_customize passed to it directly, so it knows where to hook in. (Note: This may change before final 3.4 release.)

Other controls of note:

  • WP_Customize_Upload_Control – This gives you an upload box, for allowing file uploads. However, you probably won’t use this directly, you’ll extend it for other things… like:
  • WP_Customize_Image_Control – This gives the image picker and the uploader box. It extends the upload controller. You can see it in action on the custom background piece, where a user can upload a new file to be the background image.
  • WP_Customize_Header_Image_Control – Because of the resizing action of the header piece, it needs a bit of special handling and display, so the WP_Customize_Header_Image_Control extends the WP_Customize_Image_Control to add that functionality. You can see it in action on the custom header piece, where a user can upload a new file to be the header image.

So, the way to create a custom controller to do whatever you want is to make a new class of your own which extends WP_Customize_Control and adds the bits you want. How to do that is a bit complex, so I’ll save that for another tutorial. For now, you’ve got image handling, color wheels, text boxes, radios, dropdowns, and checkboxes. I think that should be enough to get started with.

End of tutorial?

Not quite. Everything I went over above is enough to add new sections to the customizer, put controls in them, and then to have the preview show your changes after a slight delay when the page refreshes. All you have to do is to call those functions with the proper parameters, in the proper place, and it’ll work.

However, note that I said “when the page refreshes”… C’mon… this is the year 2012. We don’t have flying cars, and we still have to wait a whole second or two?

Nope.

Enter postMessage

Back when I mentioned the $wp_customize->add_setting function call, I mentioned “one more bit”. That one more bit is the option called “transport”.

Transport defines how your setting change gets from the place where you changed it into the preview pane. The default setting for this is “refresh”. An alternative setting is named “postMessage”.

The postMessage transport makes it such that the setting is instantly sent into the other frame, where javascript can adjust the page on-the-fly using this new information.

An example:

Let’s say we have a setting to change the colors of the titles. All the titles on the page are in some tag that has a class of posttitle, perhaps. The option normally just saves the HTML color chosen, then outputs some inline CSS in the header.php to basically do this:

.posttitle {
	color: #abcdef;
}

Or whatever the option actually is for that color.

We have hooked our setting to that option, and hooked our WP_Customize_Color_Control up to it, and now when we change it, it works and we can see the color change. Note that this is easiest to do with already working customizer options, so the best way to do it is to get it working normally first, then add on this next bit.

Now, we have the working option in the customizer, so to take away that refresh delay, we’ll add this new option to the add_setting call:

	'transport'         => 'postMessage',

This tells the customizer that the setting will be sent directly to the frame via javascript. However, for that setting to work, we need javascript in the frame itself to receive it.

So, back in our main function… remember that? It started like this:

add_action( 'customize_register', 'themename_customize_register' );
function themename_customize_register($wp_customize) {
	// ... do stuff ...

Right at the end of that function, we’re going to add this code:

	if ( $wp_customize->is_preview() && ! is_admin() )
		add_action( 'wp_footer', 'themename_customize_preview', 21);

This is going to add a new function call to our preview frame’s footer. It only gets added with the preview frame, so the live site and others won’t see it, because they don’t need to see it. This is where we’re going to output our javascript to make things happen in real-time.

Here’s our function:

function themename_customize_preview() {
	?>
	<script type="text/javascript">
	wp.customize('setting_name',function( value ) {
		value.bind(function(to) {
			jQuery('.posttitle').css('color', to ? '#' + to : '' );
		});
	});
	</script>
	<?php 
} 

As you can see, it just outputs a bit of javascript. This code won’t change much, ever, so let’s go over just two pieces of importance:

  • ‘setting_name’ is the name of the setting, as added by the $wp_customize->add_setting call.
  • The entire line starting with jQuery(‘.posttitle’) is our custom bit of code. It gets the “to” variable, which will be the color chosen by the user, and it sets the posttitles on the page to have that color, using the css modifying functionality of jquery.

Those are the only two bits you need to change, really. The rest is pretty copy-pasta. For each real-time setting, you can dupe this bit of code in the script.

Here’s another thing: You can change pre-existing refresh settings to be postMessage ones. Take the Site Title and Tagline elements in the Header section, for example. These are refresh settings, and the reason they are is because each theme implements them differently. There’s no way for the core to know the javascript code needed for any particular theme.

But if you’re a theme author, then you’re not writing for a generic theme. You’re writing for your particular theme. You know how the site title and tagline are displayed. There’s no reason you can’t make those update in real time. And while you’re at it, the header_textcolor setting can be real time too, since you know the theme code.

In your main function again, add these three lines of code:

	$wp_customize->get_setting('blogname')->transport='postMessage';
	$wp_customize->get_setting('blogdescription')->transport='postMessage';
	$wp_customize->get_setting('header_textcolor')->transport='postMessage';

That changes the transport on those core settings to be postMessage. Now you need to add the javascript code to actually do the refreshing in your theme. Here’s an example of TwentyEleven doing this (with the patch I wrote for it):

function twentyeleven_customize_preview() {
	?>
	<script type="text/javascript">
	wp.customize('blogname',function( value ) {
		value.bind(function(to) {
			jQuery('#site-title a').html(to);
		});
	});
	wp.customize('blogdescription',function( value ) {
		value.bind(function(to) {
			jQuery('#site-description').html(to);
		});
	});
	wp.customize( 'header_textcolor', function( value ) {
		value.bind( function( to ) {
			jQuery('#site-title a, #site-description').css('color', to ? '#' + to : '' );
		});
	});
	</script>
	<?php
}

For the blogname, it changes the HTML inside the “#site-title a” link. For the description, it changes the tag with #sitedescription. For the color of those, it simply targets both of them and alters their CSS.

Core has to try to be generic across all themes. But themes have more knowledge of how they work and can change things to target themselves in better ways. A theme adding controls knows what those controls change, so if it’s something simple like CSS or even something more complex like HTML, if you can write javascript code to make that modification in real time, then you can use postMessage and eliminate that refresh delay.

Hopefully this explains some of the theme customizer. Was it as clear as mud? Take a look at my patch to Twenty Eleven to add some of the theme options from its existing options screen into the customizer. You can find it on this ticket: http://core.trac.wordpress.org/ticket/20448.


Konstantin Kovshenin: Never Set Defaults in the Database

May 4th, 2012

Speaking of defaults, NEVER SET DEFAULTS IN THE DATABASE. Not ever. The theme options you store in the DB should always, always, *always* be something the user has selected. If the user selects the default, then that’s fine to set in the DB. but you don’t set it in the DB just because it’s not set at all. get_theme_mod has a second option for the default value. So does get_option for that matter. Use this.

Otto Wood, WordPress Core Developer on Custom Admin Screens

Thanks, Otto, for clearing that up :)


Digging into WordPress: Complete List of Default WordPress Files

May 3rd, 2012

When cleaning up hacked sites and testing .htaccess tricks, it’s nice to have a list of WordPress directory and file names for checking patterns and finding strings directly via Search/Find. Especially when working remotely, having a complete list of WordPress files available online can help expedite the attack-recovery process.

The official Codex page lists some important files, but only for WP version 2.x and doesn’t seem to list files located in all sub-directories. Sure it’s not the most exciting topic in the world, but it’s always good practice to know thy files. You get to see the bigger picture and gain a better understanding of how much stuff actually is included in WordPress — especially if you start digging around in the /wp-includes/ directory.. bring a snack, knife, and some flint to improve your chances.

We’re looking at default download/unzip of WordPress version 3.3.2 — a complete list of all files in all directories in alphabetical order. Here’s the roadmap:

Basic WordPress directory structure

/wordpress/

	/wp-admin/
		/css/
		/images/
		/includes/
		/js/
		/maint/
		/network/
		/user/

	/wp-content/
		/plugins/
			/akismet/
		/themes/
			/twentyeleven/
				/colors/
				/images/
				/inc/
					/images/
				/js/
				/languages/
			/twentyten/
				/images/
					/headers/
				/languages/
	
	/wp-includes/
		/Text/
		/css/
		/images/
			/crystal/
			/smilies/
			/wlw/
		/js/
			/crop/
			/imgareaselect/
			/jcrop/
			/jquery/
				/ui/
			/plupload/
			/scriptaculous/
			/swfupload/
				/plugins/
			/thickbox/
			/tinymce/
				/langs/
				/plugins/
					/directionality/
					/fullscreen/
					/inlinepopups/
						/skins/
							/clearlooks2/
								/img/
					/media/
						/css/
						/js/
					/paste/
						/js/
					/spellchecker/
						/classes/
							/utils/
						/css/
						/img/
						/includes/
					/tabfocus/
					/wordpress/
						/css/
						/img/
					/wpdialogs/
						/js/
					/wpeditimage/
						/css/
						/img/
						/js/
					/wpfullscreen/
					/wpgallery/
						/img/
					/wplink/
				/themes/
					/advanced/
						/img/
						/js/
						/skins/
							/default/
								/img/
							/highcontrast/
							/o2k7/
								/img/
							/wp_theme/
								/img/
				/utils/
		/pomo/
		/theme-compat/

Root-level WordPress files

/wordpress/
	index.php
	license.txt
	readme.html
	wp-activate.php
	wp-app.php
	wp-blog-header.php
	wp-comments-post.php
	wp-config-sample.php
	wp-cron.php
	wp-links-opml.php
	wp-load.php
	wp-login.php
	wp-mail.php
	wp-pass.php
	wp-register.php
	wp-settings.php
	wp-signup.php
	wp-trackback.php
	xmlrpc.php

Files in the /wp-admin/ directory

/wp-admin/
	about.php
	admin-ajax.php
	admin-footer.php
	admin-functions.php
	admin-header.php
	admin-post.php
	admin.php
	async-upload.php
	comment.php
	credits.php
	/css/
		colors-classic.css
		colors-classic.dev.css
		colors-fresh.css
		colors-fresh.dev.css
		farbtastic.css
		file-list.txt
		ie-rtl.css
		ie-rtl.dev.css
		ie.css
		ie.dev.css
		install.css
		install.dev.css
		media-rtl.css
		media-rtl.dev.css
		media.css
		media.dev.css
		wp-admin-rtl.css
		wp-admin-rtl.dev.css
		wp-admin.css
		wp-admin.dev.css
	custom-background.php
	custom-header.php
	edit-comments.php
	edit-form-advanced.php
	edit-form-comment.php
	edit-link-form.php
	edit-tag-form.php
	edit-tags.php
	edit.php
	export.php
	freedoms.php
	gears-manifest.php
	/images/
		align-center.png
		align-left.png
		align-none.png
		align-right.png
		archive-link.png
		arrows-dark-vs.png
		arrows-dark.png
		arrows-vs.png
		arrows.png
		blue-grad.png
		bubble_bg-rtl.gif
		bubble_bg.gif
		button-grad-active.png
		button-grad.png
		comment-grey-bubble.png
		date-button.gif
		ed-bg-vs.gif
		ed-bg.gif
		fade-butt.png
		fav-arrow-rtl.gif
		fav-arrow.gif
		fav-vs.png
		fav.png
		generic.png
		gray-grad.png
		gray-star.png
		icons32-vs.png
		icons32.png
		imgedit-icons.png
		list.png
		loading-publish.gif
		loading.gif
		logo-ghost.png
		logo-login.png
		logo.gif
		marker.png
		mask.png
		media-button-image.gif
		media-button-music.gif
		media-button-other.gif
		media-button-video.gif
		media-button.png
		menu-arrow-frame-rtl.png
		menu-arrow-frame.png
		menu-arrows.gif
		menu-bits-rtl-vs.gif
		menu-bits-rtl.gif
		menu-bits-vs.gif
		menu-bits.gif
		menu-dark-rtl-vs.gif
		menu-dark-rtl.gif
		menu-dark-vs.gif
		menu-dark.gif
		menu-shadow-rtl.png
		menu-shadow.png
		menu-vs.png
		menu.png
		no.png
		press-this.png
		required.gif
		resize-rtl.gif
		resize.gif
		screen-options-toggle-vs.gif
		screen-options-toggle.gif
		screenshots
		se.png
		sort.gif
		star.png
		toggle-arrow-rtl.gif
		toggle-arrow.gif
		upload-classic.png
		upload-fresh.png
		wheel.png
		white-grad-active.png
		white-grad.png
		widgets-arrow-vs.gif
		widgets-arrow.gif
		wordpress-logo.png
		wp-badge.png
		wp-logo-vs.png
		wp-logo.png
		wpspin_dark.gif
		wpspin_light.gif
		xit.gif
		yes.png
	import.php
	/includes/
		admin.php
		bookmark.php
		class-ftp-pure.php
		class-ftp-sockets.php
		class-ftp.php
		class-pclzip.php
		class-wp-comments-list-table.php
		class-wp-filesystem-base.php
		class-wp-filesystem-direct.php
		class-wp-filesystem-ftpext.php
		class-wp-filesystem-ftpsockets.php
		class-wp-filesystem-ssh2.php
		class-wp-importer.php
		class-wp-links-list-table.php
		class-wp-list-table.php
		class-wp-media-list-table.php
		class-wp-ms-sites-list-table.php
		class-wp-ms-themes-list-table.php
		class-wp-ms-users-list-table.php
		class-wp-plugin-install-list-table.php
		class-wp-plugins-list-table.php
		class-wp-posts-list-table.php
		class-wp-terms-list-table.php
		class-wp-theme-install-list-table.php
		class-wp-themes-list-table.php
		class-wp-upgrader.php
		class-wp-users-list-table.php
		comment.php
		continents-cities.php
		dashboard.php
		deprecated.php
		export.php
		file.php
		image-edit.php
		image.php
		import.php
		list-table.php
		manifest.php
		media.php
		menu.php
		meta-boxes.php
		misc.php
		ms-deprecated.php
		ms.php
		nav-menu.php
		plugin-install.php
		plugin.php
		post.php
		schema.php
		screen.php
		taxonomy.php
		template.php
		theme-install.php
		theme.php
		update-core.php
		update.php
		upgrade.php
		user.php
		widgets.php
	index-extra.php
	index.php
	install-helper.php
	install.php
	/js/
		cat.dev.js
		cat.js
		categories.dev.js
		categories.js
		comment.dev.js
		comment.js
		common.dev.js
		common.js
		custom-background.dev.js
		custom-background.js
		custom-fields.dev.js
		custom-fields.js
		dashboard.dev.js
		dashboard.js
		edit-comments.dev.js
		edit-comments.js
		editor.dev.js
		editor.js
		farbtastic.js
		gallery.dev.js
		gallery.js
		image-edit.dev.js
		image-edit.js
		inline-edit-post.dev.js
		inline-edit-post.js
		inline-edit-tax.dev.js
		inline-edit-tax.js
		link.dev.js
		link.js
		media-upload.dev.js
		media-upload.js
		media.dev.js
		media.js
		nav-menu.dev.js
		nav-menu.js
		password-strength-meter.dev.js
		password-strength-meter.js
		plugin-install.dev.js
		plugin-install.js
		post.dev.js
		post.js
		postbox.dev.js
		postbox.js
		revisions-js.php
		set-post-thumbnail.dev.js
		set-post-thumbnail.js
		tags.dev.js
		tags.js
		theme-preview.dev.js
		theme-preview.js
		theme.dev.js
		theme.js
		user-profile.dev.js
		user-profile.js
		utils.dev.js
		utils.js
		widgets.dev.js
		widgets.js
		word-count.dev.js
		word-count.js
		wp-fullscreen.dev.js
		wp-fullscreen.js
		xfn.dev.js
		xfn.js
	link-add.php
	link-manager.php
	link-parse-opml.php
	link.php
	load-scripts.php
	load-styles.php
	/maint/
		repair.php
	media-new.php
	media-upload.php
	media.php
	menu-header.php
	menu.php
	moderation.php
	ms-admin.php
	ms-delete-site.php
	ms-edit.php
	ms-options.php
	ms-sites.php
	ms-themes.php
	ms-upgrade-network.php
	ms-users.php
	my-sites.php
	nav-menus.php
	/network/
		admin.php
		edit.php
		index-extra.php
		index.php
		menu.php
		plugin-editor.php
		plugin-install.php
		plugins.php
		profile.php
		settings.php
		setup.php
		site-info.php
		site-new.php
		site-settings.php
		site-themes.php
		site-users.php
		sites.php
		theme-editor.php
		theme-install.php
		themes.php
		update-core.php
		update.php
		upgrade.php
		user-edit.php
		user-new.php
		users.php
	network.php
	options-discussion.php
	options-general.php
	options-head.php
	options-media.php
	options-permalink.php
	options-privacy.php
	options-reading.php
	options-writing.php
	options.php
	plugin-editor.php
	plugin-install.php
	plugins.php
	post-new.php
	post.php
	press-this.php
	profile.php
	revision.php
	setup-config.php
	theme-editor.php
	theme-install.php
	themes.php
	tools.php
	update-core.php
	update.php
	upgrade-functions.php
	upgrade.php
	upload.php
	/user/
		admin.php
		index-extra.php
		index.php
		menu.php
		profile.php
		user-edit.php
	user-edit.php
	user-new.php
	users.php
	widgets.php

Files in the /wp-content/ directory

/wp-content/
	index.php
	/plugins/
		/akismet/
			admin.php
			akismet.css
			akismet.gif
			akismet.js
			akismet.php
			legacy.php
			readme.txt
			widget.php
		hello.php
		index.php
	/themes/
		index.php
		/twentyeleven/
			404.php
			archive.php
			author.php
			category.php
			/colors/
				dark.css
			comments.php
			content-aside.php
			content-featured.php
			content-gallery.php
			content-image.php
			content-intro.php
			content-link.php
			content-page.php
			content-quote.php
			content-single.php
			content-status.php
			content.php
			editor-style-rtl.css
			editor-style.css
			footer.php
			functions.php
			header.php
			image.php
			/images/
				comment-arrow-bypostauthor-dark-rtl.png
				comment-arrow-bypostauthor-dark.png
				comment-arrow-bypostauthor-rtl.png
				comment-arrow-bypostauthor.png
				comment-arrow-dark-rtl.png
				comment-arrow-dark.png
				comment-arrow-rtl.png
				comment-arrow.png
				comment-bubble-dark-rtl.png
				comment-bubble-dark.png
				comment-bubble-rtl.png
				comment-bubble.png
				headers
				search.png
				wordpress.png
			/inc/
				/images/
					content-sidebar.png
					content.png
					dark.png
					light.png
					sidebar-content.png
				theme-options.css
				theme-options.js
				theme-options.php
				widgets.php
			index.php
			/js/
				html5.js
				showcase.js
			/languages/
				twentyeleven.pot
			license.txt
			page.php
			readme.txt
			rtl.css
			screenshot.png
			search.php
			searchform.php
			showcase.php
			sidebar-footer.php
			sidebar-page.php
			sidebar.php
			single.php
			style.css
			tag.php
		/twentyten/
			404.php
			archive.php
			attachment.php
			author.php
			category.php
			comments.php
			editor-style-rtl.css
			editor-style.css
			footer.php
			functions.php
			header.php
			/images/
				/headers/
					berries-thumbnail.jpg
					berries.jpg
					cherryblossoms-thumbnail.jpg
					cherryblossoms.jpg
					concave-thumbnail.jpg
					concave.jpg
					fern-thumbnail.jpg
					fern.jpg
					forestfloor-thumbnail.jpg
					forestfloor.jpg
					inkwell-thumbnail.jpg
					inkwell.jpg
					path-thumbnail.jpg
					path.jpg
					sunset-thumbnail.jpg
					sunset.jpg
				wordpress.png
			index.php
			/languages/
				twentyten.pot
			license.txt
			loop-attachment.php
			loop-page.php
			loop-single.php
			loop.php
			onecolumn-page.php
			page.php
			rtl.css
			screenshot.png
			search.php
			sidebar-footer.php
			sidebar.php
			single.php
			style.css
			tag.php

Files in the /wp-includes/ directory

/wp-includes/
	/Text/
		Diff
		Diff.php
	admin-bar.php
	atomlib.php
	author-template.php
	bookmark-template.php
	bookmark.php
	cache.php
	canonical.php
	capabilities.php
	category-template.php
	category.php
	class-IXR.php
	class-feed.php
	class-http.php
	class-json.php
	class-oembed.php
	class-phpass.php
	class-phpmailer.php
	class-pop3.php
	class-simplepie.php
	class-smtp.php
	class-snoopy.php
	class-wp-admin-bar.php
	class-wp-ajax-response.php
	class-wp-editor.php
	class-wp-error.php
	class-wp-http-ixr-client.php
	class-wp-walker.php
	class-wp-xmlrpc-server.php
	class-wp.php
	class.wp-dependencies.php
	class.wp-scripts.php
	class.wp-styles.php
	comment-template.php
	comment.php
	compat.php
	cron.php
	/css/
		admin-bar-rtl.css
		admin-bar-rtl.dev.css
		admin-bar.css
		admin-bar.dev.css
		editor-buttons.css
		editor-buttons.dev.css
		jquery-ui-dialog.css
		jquery-ui-dialog.dev.css
		wp-pointer.css
		wp-pointer.dev.css
	default-constants.php
	default-filters.php
	default-widgets.php
	deprecated.php
	feed-atom-comments.php
	feed-atom.php
	feed-rdf.php
	feed-rss.php
	feed-rss2-comments.php
	feed-rss2.php
	feed.php
	formatting.php
	functions.php
	functions.wp-scripts.php
	functions.wp-styles.php
	general-template.php
	http.php
	/images/
		admin-bar-sprite.png
		arrow-pointer-blue.png
		blank.gif
		/crystal/
			archive.png
			audio.png
			code.png
			default.png
			document.png
			interactive.png
			license.txt
			spreadsheet.png
			text.png
			video.png
		down_arrow.gif
		icon-pointer-flag.png
		rss.png
		/smilies/
			icon_arrow.gif
			icon_biggrin.gif
			icon_confused.gif
			icon_cool.gif
			icon_cry.gif
			icon_eek.gif
			icon_evil.gif
			icon_exclaim.gif
			icon_idea.gif
			icon_lol.gif
			icon_mad.gif
			icon_mrgreen.gif
			icon_neutral.gif
			icon_question.gif
			icon_razz.gif
			icon_redface.gif
			icon_rolleyes.gif
			icon_sad.gif
			icon_smile.gif
			icon_surprised.gif
			icon_twisted.gif
			icon_wink.gif
		toggle-arrow.png
		upload.png
		/wlw/
			wp-comments.png
			wp-icon.png
			wp-watermark.png
		wpicons.png
		wpmini-blue.png
		xit.gif
	/js/
		admin-bar.dev.js
		admin-bar.js
		autosave.dev.js
		autosave.js
		colorpicker.dev.js
		colorpicker.js
		comment-reply.dev.js
		comment-reply.js
		/crop/
			cropper.css
			cropper.js
			marqueeHoriz.gif
			marqueeVert.gif
		hoverIntent.dev.js
		hoverIntent.js
		/imgareaselect/
			border-anim-h.gif
			border-anim-v.gif
			imgareaselect.css
			jquery.imgareaselect.dev.js
			jquery.imgareaselect.js
		/jcrop/
			Jcrop.gif
			jquery.Jcrop.css
			jquery.Jcrop.dev.js
			jquery.Jcrop.js
		/jquery/
			jquery.color.dev.js
			jquery.color.js
			jquery.form.dev.js
			jquery.form.js
			jquery.hotkeys.dev.js
			jquery.hotkeys.js
			jquery.js
			jquery.query.js
			jquery.schedule.js
			jquery.serialize-object.js
			jquery.table-hotkeys.dev.js
			jquery.table-hotkeys.js
			suggest.dev.js
			suggest.js
			/ui/
				jquery.effects.blind.min.js
				jquery.effects.bounce.min.js
				jquery.effects.clip.min.js
				jquery.effects.core.min.js
				jquery.effects.drop.min.js
				jquery.effects.explode.min.js
				jquery.effects.fade.min.js
				jquery.effects.fold.min.js
				jquery.effects.highlight.min.js
				jquery.effects.pulsate.min.js
				jquery.effects.scale.min.js
				jquery.effects.shake.min.js
				jquery.effects.slide.min.js
				jquery.effects.transfer.min.js
				jquery.ui.accordion.min.js
				jquery.ui.autocomplete.min.js
				jquery.ui.button.min.js
				jquery.ui.core.min.js
				jquery.ui.datepicker.min.js
				jquery.ui.dialog.min.js
				jquery.ui.draggable.min.js
				jquery.ui.droppable.min.js
				jquery.ui.mouse.min.js
				jquery.ui.position.min.js
				jquery.ui.progressbar.min.js
				jquery.ui.resizable.min.js
				jquery.ui.selectable.min.js
				jquery.ui.slider.min.js
				jquery.ui.sortable.min.js
				jquery.ui.tabs.min.js
				jquery.ui.widget.min.js
		json2.dev.js
		json2.js
		/plupload/
			changelog.txt
			handlers.dev.js
			handlers.js
			license.txt
			plupload.flash.js
			plupload.flash.swf
			plupload.html4.js
			plupload.html5.js
			plupload.js
			plupload.silverlight.js
			plupload.silverlight.xap
		prototype.js
		quicktags.dev.js
		quicktags.js
		/scriptaculous/
			MIT-LICENSE
			builder.js
			controls.js
			dragdrop.js
			effects.js
			scriptaculous.js
			slider.js
			sound.js
			unittest.js
			wp-scriptaculous.js
		swfobject.js
		/swfupload/
			handlers.dev.js
			handlers.js
			license.txt
			/plugins/
				swfupload.cookies.js
				swfupload.queue.js
				swfupload.speed.js
				swfupload.swfobject.js
			swfupload-all.js
			swfupload.js
			swfupload.swf
		/thickbox/
			loadingAnimation.gif
			macFFBgHack.png
			tb-close.png
			thickbox.css
			thickbox.js
		/tinymce/
			/langs/
				wp-langs-en.js
				wp-langs.php
			license.txt
			/plugins/
				/directionality/
					editor_plugin.js
				/fullscreen/
					editor_plugin.js
					fullscreen.htm
				/inlinepopups/
					editor_plugin.js
					/skins/
						/clearlooks2/
							/img/
								alert.gif
								button.gif
								buttons.gif
								confirm.gif
								corners.gif
								drag.gif
								horizontal.gif
								vertical.gif
							window.css
					template.htm
				/media/
					/css/
						media.css
					editor_plugin.js
					/js/
						embed.js
						media.js
					media.htm
					moxieplayer.swf
				/paste/
					blank.htm
					editor_plugin.js
					/js/
						pastetext.js
						pasteword.js
					pastetext.htm
					pasteword.htm
				/spellchecker/
					changelog.txt
					/classes/
						EnchantSpell.php
						GoogleSpell.php
						PSpell.php
						PSpellShell.php
						SpellChecker.php
						/utils/
							JSON.php
							Logger.php
					config.php
					/css/
						content.css
					editor_plugin.js
					/img/
						wline.gif
					/includes/
						general.php
					rpc.php
				/tabfocus/
					editor_plugin.js
				/wordpress/
					/css/
						content.css
					editor_plugin.dev.js
					editor_plugin.js
					/img/
						audio.gif
						embedded.png
						image.gif
						media.gif
						more_bug.gif
						page.gif
						page_bug.gif
						trans.gif
						video.gif
				/wpdialogs/
					editor_plugin.dev.js
					editor_plugin.js
					/js/
						popup.dev.js
						popup.js
						wpdialog.dev.js
						wpdialog.js
				/wpeditimage/
					/css/
						editimage-rtl.css
						editimage.css
					editimage.html
					editor_plugin.dev.js
					editor_plugin.js
					/img/
						delete.png
						image.png
					/js/
						editimage.dev.js
						editimage.js
				/wpfullscreen/
					editor_plugin.js
					fullscreen.htm
				/wpgallery/
					editor_plugin.dev.js
					editor_plugin.js
					/img/
						delete.png
						edit.png
						gallery.png
						t.gif
				/wplink/
					editor_plugin.dev.js
					editor_plugin.js
			/themes/
				/advanced/
					about.htm
					anchor.htm
					charmap.htm
					color_picker.htm
					editor_template.js
					image.htm
					/img/
						colorpicker.jpg
						flash.gif
						gotmoxie.png
						icons.gif
						iframe.gif
						pagebreak.gif
						quicktime.gif
						realmedia.gif
						shockwave.gif
						trans.gif
						video.gif
						windowsmedia.gif
					/js/
						about.js
						anchor.js
						charmap.js
						color_picker.js
						image.js
						link.js
						source_editor.js
					link.htm
					shortcuts.htm
					/skins/
						/default/
							content.css
							dialog.css
							/img/
								buttons.png
								items.gif
								menu_arrow.gif
								menu_check.gif
								progress.gif
								tabs.gif
							ui.css
						/highcontrast/
							content.css
							dialog.css
							ui.css
						/o2k7/
							content.css
							dialog.css
							/img/
								button_bg.png
								button_bg_black.png
								button_bg_silver.png
							ui.css
							ui_black.css
							ui_silver.css
						/wp_theme/
							content.css
							dialog.css
							/img/
								tabs.gif
							ui.css
					source_editor.htm
			tiny_mce.js
			tiny_mce_popup.js
			/utils/
				editable_selects.js
				form_utils.js
				mctabs.js
				validate.js
			wp-mce-help.php
			wp-tinymce.js.gz
			wp-tinymce.php
		tw-sack.dev.js
		tw-sack.js
		wp-ajax-response.dev.js
		wp-ajax-response.js
		wp-list-revisions.dev.js
		wp-list-revisions.js
		wp-lists.dev.js
		wp-lists.js
		wp-pointer.dev.js
		wp-pointer.js
		wplink.dev.js
		wplink.js
	kses.php
	l10n.php
	link-template.php
	load.php
	locale.php
	media.php
	meta.php
	ms-blogs.php
	ms-default-constants.php
	ms-default-filters.php
	ms-deprecated.php
	ms-files.php
	ms-functions.php
	ms-load.php
	ms-settings.php
	nav-menu-template.php
	nav-menu.php
	pluggable-deprecated.php
	pluggable.php
	plugin.php
	/pomo/
		entry.php
		mo.php
		po.php
		streams.php
		translations.php
	post-template.php
	post-thumbnail-template.php
	post.php
	query.php
	registration-functions.php
	registration.php
	rewrite.php
	rss-functions.php
	rss.php
	script-loader.php
	shortcodes.php
	taxonomy.php
	template-loader.php
	/theme-compat/
		comments-popup.php
		comments.php
		footer.php
		header.php
		sidebar.php
	theme.php
	update.php
	user.php
	vars.php
	version.php
	widgets.php
	wlwmanifest.xml
	wp-db.php
	wp-diff.php

Digging into WordPress: Poll: www. or no www.?

May 2nd, 2012

This one’s self-explanatory, but a lot has changed so I thought I’d poll one up to see what people think. It seems there are a lot more sites these days without the www. in their canonical URLs, but a lot of big sites continue to include the “www” subdomain (think Google home page). Which one is best? Let’s find out..

In this poll, you’re asked whether you prefer URLs with or without the extra www. subdomain. But you have to choose one or the other — no “other/undecided” votes allowed on this one ;)

Okay, drumroll please..

Do you prefer "www." or no "www." in URLs?

View Results

Loading ... Loading ...

WPBeginner » Tutorials: How To Show Number of Queries and Page Load Time in WordPress

May 2nd, 2012

One of our users asked how do other sites show number of queries and page load time in the footer. You will often see this in the footer of sites and it may say something like: “64 queries in 1.248 seconds”. In this article, we will show you how to show number of queries and page load time in WordPress.

Simply paste the following code anywhere you like in your theme files (such as footer.php).

<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.

And refresh the page. You will see the number of queries and the execution time.

How To Show Number of Queries and Page Load Time in WordPress is a post from: WPBeginner which is not allowed to be copied on other sites.