Results 61 - 70 of about 12807 stories
WP Weekly on 25 January 2012, 8:00 am   Category: Blog

It’s been a long time since I published any episodes of WordPress Weekly and it’s not without good reason. I am still in the middle of transitioning from one dwelling to another and this is the primary reason why I haven’t been able to produce an episode. During the past few months, I’ve not been able to spend as much time behind the PC as I’d like which also explains why I’ve been publishing more short form content versus long form. I’d like to explain everything I’ve personally been through during 2011 and now going into 2012 but it would take up a novels worth of space. Lets just say that in 2011, we had to purchase a new roof for our home, new vinyl soffits, other home improvements and some of them were forced on us thanks to the appraiser who told us some items needed to be repaired or renewed before he would approve of the home in order for us to transfer the mortgage.

Putting all that personal stuff aside, I’ve been making strides and within the next 2-3 months, I expect to be moved into a new home as well as have my new office put together. Once this happens, I’ll be able to concentrate on producing the show on a weekly basis again. Regarding the show, I’ve decided not to produce it live on a weekly basis. Instead, the majority of episodes will be pre-recorded via Skype which is not only a benefit in terms of audio quality, but makes it much more convenient for both myself and the people I’ll be interviewing. There are plenty of people that I want to talk to throughout the course of the year and I look forward to being able to engage in spirited conversations with the people that are doing great things with WordPress.

Related posts:

  1. My Thoughts On WordPress Weekly
  2. First WordPress Weekly Listening Party
  3. Whats In Store For WordPress Weekly


Matt Mullenweg on 24 January 2012, 1:59 pm   Category: Blog

Today Y Combinator announced they are adding two new partners, Garry Tan and Aaron Iba. This is announcement is unique because it does not list their academic credentials, their previous investments, the boards of companies or non-profits they have sat on, how many years of experience they have, or any of the usual badges of honor investors parade in their biographies and Crunchbase profiles.

Instead we get accolades of “rare individuals who can both design and program” and “best hackers among the YC alumni.” Take note of this moment.

I was part of a dinner conversation the other night that included institutional and angel investors, entrepreneurs, and someone who was part of the YC program. The group circled with alarming intent on grilling the YC entrepreneur: “How much time did you actually get with PG?” “It’s a cult of personality.” “The average quality of the companies has really dropped as they’ve broadened.” “I can’t wait for this bubble to pop.” I believe it was mostly in jest — few topics were spared that night — but there was some truth in the defensive undertone.

The hackers and engineers of Y Combinator are doing what hackers and engineers do to any industry, they’re efficiently and ruthlessly disrupting the traditional model of venture capital and are going to destroy far more more wealth for their contemporaries than they create for themselves, as broadband did to entertainment, Craigslist did to newspapers, and Amazon did to traditional retailers. This is what outsiders, by definition, do.

The dark humor in this is that the same people who delight and celebrate investing in disrupting other industries are blind or in denial about it happening to their own.

The question then becomes if you’re an investor with a traditional LP model (and expectations), or a more financial background than an operational one, or an operational background more in management than in design or coding, what should you do to stay relevant through this shift?


WP Tavern on 24 January 2012, 8:00 am   Category: Plugins

Daniel Immke has published his own primer on using native user interface elements for the administration of plugins. By following his basic primer, you’ll be on your way to creating a plugin that looks and functions as if it were a part of the core of WordPress which is what plugin developers should be aiming for. WooCommerce is an excellent example of the various UI elements that are built within WordPress that plugin authors should be taking advantage of.    

Related posts:

  1. Tips On Creating A Good Plugin Readme.txt File
  2. Good Guide On Avoiding Theme/Plugin Lock-In
  3. How Commercial Plugin Developers Are Monetizing Through The Plugin Respository


Weblog Tools Collection on 24 January 2012, 7:00 am   Category: Themes

Evergreen is a colorful theme that packs a visual punch.

Famous is an advanced theme for business, portfolio or blog usage.


WP Tavern on 23 January 2012, 12:00 pm   Category: News

Knowing that a lot of people use DreamHost for their WordPress powered websites, it’s a bit unsettling to see that suspicious activity was detected within one of their databases and thus, passwords have been reset across FTP/Shell and VPS customer accounts. If you use DreamHost and have not been able to log-in recently, this may explain why.

Related posts:

  1. GoDaddy Hacks Due To Old Software – Bad Passwords


CatsWhoCode on 23 January 2012, 9:04 am   Category: Blog

What is the transients API, and why it’s useful

Most developers who worked with WordPress in the past probably ever heard of the Options API, which allow you to save, update and delete custom values. The Transients API is pretty similar to the Options API, but with the feature of an expiration time, which simplifies the process of using the wp_options database table to store cached information.

After you read the practical example I’ve listed on this post, I suggest you to read the Transients API page on WordPress Codex.

List sites from your network

Let’s start with an interesting snippet for those who run networks of many blogs. The code below display a general menu of all sites from your networks. In this case, transients are used to store the data for a defined time (which can be set using the $expires variable on line 1) so you’ll not make huge database calls each time your menu have to be displayed.

To use this snippet, first you have to paste the function into your functions.php file.

function wp_list_sites( $expires = 7200 ) {
   if( !is_multisite() ) return false;

   // Because the get_blog_list() function is currently flagged as deprecated
   // due to the potential for high consumption of resources, we'll use
   // $wpdb to roll out our own SQL query instead. Because the query can be
   // memory-intensive, we'll store the results using the Transients API
   if ( false === ( $site_list = get_transient( 'multisite_site_list' ) ) ) {
      global $wpdb;
      $site_list = $wpdb->get_results( $wpdb->prepare('SELECT * FROM wp_blogs ORDER BY blog_id') );
      // Set the Transient cache to expire every two hours
      set_site_transient( 'multisite_site_list', $site_list, $expires );
   }

   $current_site_url = get_site_url( get_current_blog_id() );

   $html = '
<ul id="network-menu">' . "\n";

   foreach ( $site_list as $site ) {
      switch_to_blog( $site->blog_id );
      $class = ( home_url() == $current_site_url ) ? ' class="current-site-item"' : '';
      $html .= "\t" . '
<li id="site-' . $site->blog_id . '" '="" .="" $class=""><a href="' . home_url() . '">' . get_bloginfo('name') . '</a></li>

' . "\n";
      restore_current_blog();
   }

   $html .= '</ul>

<!--// end #network-menu -->' . "\n\n";

   return $html;
}

Once done, the following code will display all sites from your network. Simply paste it on any of theme files, where you want the list to be displayed.

<?php
// Multisite Network Menu
$network_menu = wp_list_sites();
if( $network_menu ):
?>
<div id="network-menu">
   <?php echo $network_menu; ?>
</div>

<!--// end #network-menu -->
<?php endif; ?>

→ Source: http://wp.smashingmagazine.com/2011/11/17/wordpress…/

Twitter followers count using WordPress transients

Many blogs, including this one, are displaying how many people are following them on Twitter. It’s quite easy to grab some json data, but it takes a significant amount of time. Using transients allow you to grab the json data from Twitter once a day, and store it in your database for future uses.

Simply paste the function below into your functions.php file:

function my_followers_count($screen_name = 'kovshenin'){
	$key = 'my_followers_count_' . $screen_name;

	// Let's see if we have a cached version
	$followers_count = get_transient($key);
	if ($followers_count !== false)
		return $followers_count;
	else
	{
		// If there's no cached version we ask Twitter
		$response = wp_remote_get("http://api.twitter.com/1/users/show.json?screen_name={$screen_name}");
		if (is_wp_error($response))
		{
			// In case Twitter is down we return the last successful count
			return get_option($key);
		}
		else
		{
			// If everything's okay, parse the body and json_decode it
			$json = json_decode(wp_remote_retrieve_body($response));
			$count = $json->followers_count;

			// Store the result in a transient, expires after 1 day
			// Also store it as the last successful using update_option
			set_transient($key, $count, 60*60*24);
			update_option($key, $count);
			return $count;
		}
	}
}

echo "I have " . my_followers_count('kovshenin') . " followers";

→ Source: http://kovshenin.com/2010/05/twitter-followers-count-snippet-for-wordpress-2253/

RSS subscribers count using WordPress transients

Using exactly the same technique as demonstrated above, we can grab RSS subscribers and store the result in WordPress database. Don’t forget to update the code with your own feedburner url on line 2. Then, paste the code where you’d like to display how many RSS feed readers you have.

function feed_subscribers(){
        $feed_url = 'http://feeds.feedburner.com/yourname';
        $count = get_transient('feed_count');
        if ($count != false) return $count;
	$count = 0;
        $data  = wp_remote_get('http://feedburner.google.com/api/awareness/1.0/GetFeedData?uri='.$feed_url.'');
   if (is_wp_error($data)) {
        return 'error';
   }else{
	$body = wp_remote_retrieve_body($data);
	$xml = new SimpleXMLElement($body);
	$status = $xml->attributes();
	if ($status == 'ok') {
		$count = $xml->feed->entry->attributes()->circulation;
	} else {
		$count = 300; // fallback number
	}
   }
	set_transient('feed_count', $count, 60*60*24); // 24 hour cache
	echo $count;
}

→ Source: https://wpsnipp.com/index.php/functions-php/get-feedburner-count-using-get_transient-and-wp_remote_get/

Cached navigation menu

Introduced in WordPress 3.0, the new menu system is definitely an improvement to WordPress. But using transients, we can even do something better, a menu with the same functionality but without the huge database requests.

<?php
/**
 * Wrapper function around wp_nav_menu() that will cache the wp_nav_menu for all tag/category
 * pages used in the nav menus
 * @see http://lookup.hitchhackerguide.com/wp_nav_menu for $args
 * @author tott
 */ 
function hh_cached_nav_menu( $args = array(), $prime_cache = false ) {
	global $wp_query;

	$queried_object_id = empty( $wp_query->queried_object_id ) ? 0 : (int) $wp_query->queried_object_id;

	// If design of navigation menus differs per queried object use the key below
	// $nav_menu_key = md5( serialize( $args ) . '-' . $queried_object_id );

	// Otherwise
	$nav_menu_key = md5( serialize( $args ) );

	$my_args = wp_parse_args( $args );
	$my_args = apply_filters( 'wp_nav_menu_args', $my_args );
	$my_args = (object) $my_args;

	if ( ( isset( $my_args->echo ) && true === $my_args->echo ) || !isset( $my_args->echo ) ) {
		$echo = true;
	} else {
		$echo = false;
	}

	$skip_cache = false;
	$use_cache = ( true === $prime_cache ) ? false : true;

	// If design of navigation menus differs per queried object comment out this section
	//*
	if ( is_singular() ) {
		$skip_cache = true;
	} else if ( !in_array( $queried_object_id, hh_get_nav_menu_cache_objects( $use_cache ) ) ) {
		$skip_cache = true;
	}
	//*/

	if ( true === $skip_cache || true === $prime_cache || false === ( $nav_menu = get_transient( $nav_menu_key ) ) ) {
		if ( false === $echo ) {
			$nav_menu = wp_nav_menu( $args );
		} else {
			ob_start();
			wp_nav_menu( $args );
			$nav_menu = ob_get_clean();
		}
		if ( false === $skip_cache )
			set_transient( $nav_menu_key, $nav_menu );
	} 
	if ( true === $echo )
		echo $nav_menu;
	else
		return $nav_menu;
}

/**
 * Invalidate navigation menu when an update occurs
 */
function hh_update_nav_menu_objects( $menu_id = null, $menu_data = null ) {
	hh_cached_nav_menu( array( 'echo' => false ), $prime_cache = true );
}
add_action( 'wp_update_nav_menu', 'hh_update_nav_menu_objects' );

/** 
 * Helper function that returns the object_ids we'd like to cache
 */
function hh_get_nav_menu_cache_objects( $use_cache = true ) {
	$object_ids = get_transient( 'hh_nav_menu_cache_object_ids' );
	if ( true === $use_cache && !empty( $object_ids ) ) {
		return $object_ids;
	}

	$object_ids = $objects = array();

	$menus = wp_get_nav_menus();
	foreach ( $menus as $menu_maybe ) {
		if ( $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id ) ) {
			foreach( $menu_items as $menu_item ) {
				if ( preg_match( "#.*/category/([^/]+)/?$#", $menu_item->url, $match ) )
					$objects['category'][] = $match[1];
				if ( preg_match( "#.*/tag/([^/]+)/?$#", $menu_item->url, $match ) )
					$objects['post_tag'][] = $match[1];
			}
		}
	}
	if ( !empty( $objects ) ) {
		foreach( $objects as $taxonomy => $term_names ) {
			foreach( $term_names as $term_name ) {
				$term = get_term_by( 'slug', $term_name, $taxonomy );
				if ( $term )
					$object_ids[] = $term->term_id;
			}
		}
	}

	$object_ids[] = 0; // that's for the homepage

	set_transient( 'hh_nav_menu_cache_object_ids', $object_ids );
	return $object_ids;
}

→ Source: http://hitchhackerguide.com/2011/10/07/caching-wordpress-navigation-menus-wp_nav_menu-wrapper/

Cached Tag cloud

Thanks to WordPress transients API, caching almost anything is definitely. The following example shows how to cache the good old tag cloud. Simply paste this code wherever you want you tag cloud to be displayed.

$tag_cloud = get_transient( 'tag_cloud' );
if ( false === $tag_cloud || '' === $tag_cloud ){
	$args = array('echo' => false);
	$tag_cloud = wp_tag_cloud( $args );
	set_transient( 'tag_cloud', $tag_cloud, 60*60*12 );
}
echo $tag_cloud;

→ Source: http://wpengineer.com/2148/simple-cache-with-the-wordpress-transient-api/

Caching any custom query using transients

Is your theme using custom queries? If yes, you should definitely use the transients API to cache the queries. The following code shows how to cache a custom query. As you can see, there’s nothing complicated at all.

<?php
// Get any existing copy of our transient data
if ( false === ( $special_query_results = get_transient( 'special_query_results' ) ) ) {
    // It wasn't there, so regenerate the data and save the transient
     $special_query_results = new WP_Query( 'cat=5&order=random&tag=tech&post_meta_key=thumbnail' );
     set_transient( 'special_query_results', $special_query_results );
}

// Use the data like you would have normally...
?>

→ Source: http://codex.wordpress.org/Transients_API


Weblog Tools Collection on 23 January 2012, 7:00 am   Category: News

iThemes has now added a huge student discount to their popular Web Designer’s Toolkit. The new Student Edition offers full-time students in the US and Canada access to over 150 themes, over 20 plugins, and over 300 hours of training for only $97 ($880 less than the original).

Folks with a strong memory may notice the similarity to iThemes’s Educator Program. While the Student Edition of the toolkit is not free, the $880 discount is something that can’t be beat, especially if you’re busy spending money on your tuition. If you have plans to launch a WordPress-focused career in design, consulting, maintenance, and other such things, this is a great way to get a head start.

Disclaimer: iThemes is one of our advertisers.


Reblogging is Back! 2 weeks ago.

WordPress.com on 22 January 2012, 1:27 pm   Category: Blog

As we mentioned last week, you can like and reblog posts directly from your reader, which displays a stream of all the updates published on all the blogs you follow from your WordPress.com account.

We’ve also brought the reblog button back to the toolbar that appears at the top of the screen when you’re logged into WordPress.com. Note that you’ll only see the like and reblog options while you’re looking at individual posts.

For example, you’ll see this on the left side of your toolbar while viewing http://en.blog.wordpress.com/2012/01/20/read-blogs:

And your toolbar will look like this while you’re browsing the home page of en.blog.wordpress.com:

How does reblogging work?

Reblogging is a quick way to share posts published by other WordPress.com users on your own blog.

When a post is reblogged, it shows up with a link back to the blog it came from, the first image in the post, an excerpt of the post’s introduction (if it contains text), and thumbnails of any other images that the post contains. It also shows any comments left by the person who reblogged the post:

Reblogs published on blogs you follow will also appear in your reader:

What happens when my posts get reblogged?

An excerpt of your post will be published on the reblogger’s site (with a link back to your original post), and you’ll receive a reblog notification in the post comments (you might need to approve it first):

You’ll also receive an email notification of the reblog.

Can I stop my posts from being reblogged?

Only posts on private blogs cannot be reblogged. Keep in mind that all reblogs contain a link back to your original post, so the more people reblog your posts, the more likely it is that you’ll attract new visitors (and perhaps new followers, too!).

What happens if I reblog a reblog?

If, for example, Stephane reblogs a WordPress.com announcement on his site and Lori reblogs Stephane’s reblog, Lori only re-publishes any comments Stephane made about the announcement. If Lori wants to share the original announcement, she should reblog the post from en.blog.wordpress.com, not from Stephane’s reblog. But if Stephane leaves a really clever comment, Lori might want to share it by reblogging his reblog on her site.

Can I edit a post I’ve reblogged?

You can go back and edit the comments you left when you reblogged a post, but you cannot edit any parts of the original post excerpt (including the post title). If you like, you can add categories or tags to the post. Reblogs show up under Posts → All Posts in your dashboard, and they can be edited the same way you edit your own posts.



Justin Tadlock on 21 January 2012, 8:57 am   Category: Blog

Recently, I’ve been giving a lot of thought to the debate over whether it’s better to develop large plugins that handle many related tasks or smaller, mini-plugins that handle extremely specific tasks. There’s merit to both arguments, but I wanted to give my readers a chance to discuss this and help me come to a decision about how I developer some of my future plugins.

The biggest reason for this article is that I’ve been trying to make a final decision on how one (or multiple as the case may be) of my plugins will be developed. Other plugin developers might also find this discussion useful in helping them make decisions.

The example plugin

I want you to have an example of what I’m asking you to discuss, so I’ll give you a few details on the plugin(s) I’m developing. It is a set of extensions to how comments are handled in WordPress. Some of these extensions inlude:

  • Moderate all non-Enlish comments.
  • Automatically delete spam on a schedule.
  • Turn on/off comments for specific post types by default (like with posts).
  • Moderate all trackbacks and pingbacks.
  • And more.

The plugin currently has several options like the above. Basically, it’s just an extension to the “Discussion Settings” page in the WordPress admin. It’s easy to see how some users might only want to use one or two of those settings rather than all of them.

Advantages of a single plugin

The following is a list of some of the advantages to running a single plugin:

  • You only have to run one plugin. Many people live in fear of running “too many plugins” because it might somehow break their site. Realistically, running too many large or poorly-coded plugins would be more of a problem. While you can’t really have too many plugins, this fear from users is something to consider.
  • Fewer things to manage. No one likes to update plugins every day. The more plugins you have, the more likely you’ll have to update them frequently. Having to only update a single plugin instead of several is easier.
  • Fewer translation files. Translators would only have to update and maintain a single translation file for one plugin as opposed to multiple translations for multiple plugins.

Advantages of multiple plugins

The list below is some of the advantages of using several plugins.

  • You don’t have to load code you don’t need. Using mini plugins means that you only have to load and run code that you absolutely want. With a single plugin, there may be several parts of the plugin that you don’t want to use.
  • There’s generally fewer bugs. Less code in a plugin means there’s less chance of bugs arising. It also makes it easier to find and fix bugs more quickly. Thus, allowing plugin developers to quickly get out new releases when they’re needed.
  • Fewer database options. With multiple plugins, sometimes you don’t need an option at all. The plugin simply works. With a single, large plugin, each setting might need to be enabled/disabled.

What are your thoughts?

Think about the example plugin I mentioned early in the post. If I allowed you to make the final decision on whether you’d like to see this developed as a single plugin or multiple plugins, which would you choose?

Now, think about the plugins you currently have installed on your site. Are there some that you’d like to see broken down into smaller plugins that only handled specific tasks?

Are there any other advantages or disadvantages you’d like to share?


Get in touch