FB Share Issue with WordPress Cache Plugin

Solution A: create a different cache for Facebook

  1. Go to W3 Total Cache settings (Performance) > User Agent Groups page.
  2. While you are at it, tick Enabled for the predefined groups there. This solves the Mobile specific settings have no effect problem too.
  3. Click the Create a group button at the top.
  4. Enter Facebook as the group name.
  5. Add this to the User agents field:
facebookexternalhit
facebookexternalhit/1.1
facebookexternalhit/1.0
  1. Click the Save all settings button.

Solution B: reject caching for Facebook

  1. Find the W3 Total Cache settings (Performance) > Page cache > Advanced section > Rejected user agents setting.
  2. Add this as value:
facebookexternalhit
facebookexternalhit/1.1
facebookexternalhit/1.0
  1. Click the Save all settings button.

The Facebook Crawler

facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
facebookexternalhit/1.1

MacOS Localhost Permissions for Apache

Are you receiving the dreaded “Connection Information” permission issue on your local Mac OS X environment? You’re not alone – and thankfully there is a simple solution to this issue.

You are receiving this error because the default webserver user which runs httpd is known as _www, which is not the user in your local account. If you’re the only person that uses your machine, you can change the user to fix the permission issue.

In the terminal, type the following and hit enter:
id

This will return a string of information, however the only information you need is the primary user uid and group gid names.
uid=501(admin) gid=20(staff)

Once you have this information, you will need to edit your httpd.conf file. Type the following:
sudo nano /etc/apache2/httpd.conf You’ll likely need to type your admin password to edit his file.

Hit Ctrl+W to search the file for “User “. This will take you directly to the place in the file where you need to edit information.

You can see in this file that I commented out the existing user and group with the # sign.  Below that I entered the User and Group from the information I found in step 2.

You need to restart apache for the change to take effect.
sudo apachectl restart

Congratulations, you are now running httpd as your local account.

Add Page Template from Plugin

/**
 * Add page templates.
 *
 * @param array $templates The list of page templates
 *
 * @return array  $templates  The modified list of page templates
 */
function sf_add_page_template_to_dropdown( $templates ) {
	$templates[ plugin_dir_path( __FILE__ ) . 'templates/page-template.php' ] = __( 'Page Template From Plugin', 'text-domain' );
	
	return $templates;
}

add_filter( 'theme_page_templates', 'pt_add_page_template_to_dropdown' );

Add Page Template Column on Admin Page Table

/*
 * Add Page Template Column on Admin Page Table
 */
function asiq_page_column_views( $defaults ) {
	$defaults['page-layout'] = __( 'Template' );
	
	return $defaults;
}

add_filter( 'manage_pages_columns', 'asiq_page_column_views' );

function asiq_page_custom_column_views( $column_name, $id ) {
	if ( $column_name === 'page-layout' ) {
		$set_template = get_post_meta( get_the_ID(), '_wp_page_template', true );
		if ( $set_template == 'default' ) {
			echo 'Default';
		}
		$templates = get_page_templates();
		ksort( $templates );
		foreach ( array_keys( $templates ) as $template ) {
			if ( $set_template == $templates[ $template ] ) {
				echo $template;
			}
		}
	}
}

add_action( 'manage_pages_custom_column', 'asiq_page_custom_column_views', 5, 2 );