10 useful new WordPress hacks

Remove comments autolinks

If someone leaves a comment containing a url, the url will be automatically transformed to a link by WordPress. This can be useful, but personally I don’t like to see many links in comments, especially when they’re a bit spammy.
This is why I decided, on the latest CWC theme, to remove comments autolink. Doing so is pretty easy, just paste the following into your functions.php file. Once you saved the file, you’ll notice that autolinks have disappeared.

remove_filter('comment_text', 'make_clickable', 9);

» Source: http://www.wprecipes.com/wordpress-hack-remove-autolinks-in-comments

Automatically notify your users of new posts

If you run a private site using WordPress, then it could be useful to notify your users when a new post is published. The following snippet will get all user emails from your database and will send an email to them automatically when a post is published.
Of course, you shouldn’t use that code on your blog as it does not currently have any unsubscribe option.

function email_members($post_ID)  {
    global $wpdb;
    $usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;");
    $users = implode(",", $usersarray);
    mail($users, "New WordPress recipe online!", 'A new recipe have been published on http://www.catswhocode.com');
    return $post_ID;
}

add_action('publish_post', 'email_members');

Twitter style “time ago” dates

Displaying dates using the “5 days ago” format is becoming very popular on blogs, thanks to Twitter popularity.
I have seen lots of complicated tutorials to use this format on your WordPress blog, however many people don’t know that WordPress has a built-in function to do the same thing:

human_time_diff()

.

Paste the snippet below anywhere within the loop, and it will display your dates using the “time ago” format.

Posted <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago'; ?>

» Source: http://www.phpsnippets.info/display-dates-as-time-ago

Display post thumbnail in your RSS feed

Introduced in WordPress 2.9, the

the_post_thumbnail()

function is very useful to easily add and display a thumbnail attached to a post. Unfortunately, there’s no built-in way to display this thumbnail on your RSS feed.

Happily, the function below will solve this problem. Simply paste it in your

functions.php

, save it, and the post thumbnail will be automatically displayed on your RSS feed.

function diw_post_thumbnail_feeds($content) {
	global $post;
	if(has_post_thumbnail($post->ID)) {
		$content = '<div>' . get_the_post_thumbnail($post->ID) . '</div>' . $content;
	}
	return $content;
}
add_filter('the_excerpt_rss', 'diw_post_thumbnail_feeds');
add_filter('the_content_feed', 'diw_post_thumbnail_feeds');

» Source: http://digwp.com/2010/06/show-post-thumbnails-in-feeds/

Block external requests

By default, WordPress does some external requests in order to get the available updates and the WordPress news shown in your dashboard. Personally, I don’t mind them, but I’ve recently had clients who didn’t wanted any external requests. So, I’ve blocked them using this interesting hack.
Simply add the following line to your

wp-config.php

file:

define('WP_HTTP_BLOCK_EXTERNAL', true);

If you need to allow some external requests, it it easy to create a whitelist, as shown below:

define('WP_ACCESSIBLE_HOSTS', 'rpc.pingomatic.com');

This line of code have to be pasted in

wp-config.php

as well.
» Source: http://digwp.com/2010/08/pimp-your-wp-config-php/

Easy debug mode

When things go wrong, you can always use the super useful WordPress debug tool,

WP_DEBUG

. By default, you have to paste a line of code in your

wp-config.php

to make the debug mode available.
By if you need to easily access the debug mode even when your site is live, you should edit your

wp-config.php

file and replace

define('WP_DEBUG', true);

by:

if ( isset($_GET['debug']) && $_GET['debug'] == 'debug')
  define('WP_DEBUG', true);

Once done, simply add a GET parameter to the url of the page you’d like to debug, as shown below:

http://www.catswhocode.com/blog/about?debug=debug

Of course, for obvious security reasons you should replace the name debug by a random word of your choice so no one will ever see your site in debug mode.
» Source: http://yoast.com/wordpress-debug/

Use WordPress shortcode in theme files

WordPress shortcodes are a super easy way to add content such as rss feeds, google maps, galleries and more into your posts or pages. But what about being able to output shortcodes in your theme files?
A built-in function exists, but most people never heard of it. The function is called

do_shortcode()

. It takes one parameter, the shortcode you’d like to display. I’ve heard you can ad more than one shortcode as a parameter, but I haven’t tried it yet.

do_shortcode('[gallery]
');

» Source: http://codex.wordpress.org/Function_Reference/do_shortcode

Allow upload of more file types

If you ever tried to upload some not so common filetypes, such as Textmate’s

.tmCommand

to your WordPress blog, you may have experienced an error, because WordPress simply doesn’t want you to upload some other file type.
Fortunately, you can add new file types to WordPress whitelist. Doing so is quite easy, just paste the following piece of code in your

functions.php

, and you’re done.
Note that file types have to be separated by a pipe.

function addUploadMimes($mimes) {
    $mimes = array_merge($mimes, array(
        'tmbundle|tmCommand|tmDragCommand|tmSnippet|tmLanguage|tmPreferences' => 'application/octet-stream'
    ));

    return $mimes;
}

add_filter('upload_mimes', 'addUploadMimes');

» Source: http://www.wprecipes.com/wordpress-tip-allow-upload-of-more-file-types

Google Docs PDF viewer shortcode

Google Docs is definitely the easiest way to read documents in .pdf, .doc or .xls online. So, if you want to share a PDF file with your readers, what about creating a shortcode that will open the PDF in Google Docs instead of forcing download?

Simply paste the code in your

functions.php

.

function pdflink($attr, $content) {
	return '<a class="pdf" href="http://docs.google.com/viewer?url=' . $attr['href'] . '">'.$content.'</a>';
}
add_shortcode('pdf', 'pdflink');

Once you saved the file, you’ll be able to use the shortcode on your posts and page. Here is the syntax:

[pdf href="http://yoursite.com/linktoyour/file.pdf"]View PDF[/pdf]

» Source: http://www.wprecipes.com/wordpress-tip-create-a-pdf-viewer-shortcode

Detect the visitor browser within WordPress

Well, this hack is not so new, but it still remains one of my favorites. What this code does is pretty simple, it detects the name of the visitor browser and adds it to the

body_class()

function.
That way, you can correct browser-specific problems extremely easily. The function has to be pasted in your

functions.php

file.

add_filter('body_class','browser_body_class');
function browser_body_class($classes) {
	global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;

	if($is_lynx) $classes[] = 'lynx';
	elseif($is_gecko) $classes[] = 'gecko';
	elseif($is_opera) $classes[] = 'opera';
	elseif($is_NS4) $classes[] = 'ns4';
	elseif($is_safari) $classes[] = 'safari';
	elseif($is_chrome) $classes[] = 'chrome';
	elseif($is_IE) $classes[] = 'ie';
	else $classes[] = 'unknown';

	if($is_iphone) $classes[] = 'iphone';
	return $classes;
}

The function output will look like:

<body class="home blog logged-in safari">

» Source: http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/

Like CatsWhoCode? If yes, don’t hesitate to check my other blog CatsWhoBlog: It’s all about blogging!

10 useful new WordPress hacks

Tags: - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Read More...

Who Will Redbox Choose as Its Digital Partner?

Expectations were high that Redbox would announce its strategy for digital delivery on today’s Coinstar earnings call, and those who believed that the company would lay out its plan must have been disappointed. While the company confirmed that it would go to market with a digital offering in 2011, and said it would do so with a partner, the DVD kiosk company had little to say about the specifics of what such a plan would look like.

Coinstar CEO Paul Davis said that the company spent a good long time debating whether or not to build its own digital offering or to find another company to partner with. But in the end Redbox decided that the partner strategy was the way to go, based on its ability to roll out a digital offering quickly from a technological perspective, as well as a partner’s ability to offer up a wide range of digital content without the DVD kiosk firm having to do a lot of heavy lifting in striking content deals.

While Redbox declined to name which companies it was in discussions with, it did talk about the reasons why it would be an attractive partner for any of those companies. “Consumers have told us that they are hungry for [digital content],” Davis told analysts on the call. Not just that, but Redbox customers are well-positioned to take advantage of a digital offering, with 91 percent of them having broadband connections at home. Finally, Redbox said its strong brand and extensive physical presence would also offer up a opportunity for any potential partners.

That said, it’s not clear whether Redbox would roll out a subscription service to compete against Netflix, as has been widely rumored, or whether it would pursue a digital VOD strategy to compete against rentals from iTunes and other digital storefronts. That strategy would primarily depend on whatever partner it chooses and which options are available through such a deal. With that in mind, these are probably the top potential partners for a Redbox digital offering:

Walmart

Walmart and Redbox have long been partners in the physical DVD world, with the big box retailer playing host to a number of its kiosks around the country. It would only make sense for Walmart to extend that partnership to the digital realm. Wal-mart purchased Vudu earlier this year, and the digital video subsidiary has been mainly quiet ever since. Vudu has distribution on a number of connected consumer electronics devices, and just announced today that it has struck a deal to bring Hollywood movies to the Boxee Box. With Vudu back out of its quiet mode, it wouldn’t be surprising for Walmart to leverage that asset to help out Redbox with a white-label or co-branded offering from Vudu.

Pros: A wide distribution on CE devices, a strong partnership with Redbox already.

Cons: Walmart has struggled with digital offerings in the past.

Amazon

Ever since Amazon rolled out its video on demand offering, it has struggled to gain traction in the digital marketplace, mainly playing second fiddle to Apple’s iTunes. Even so, Amazon has managed to snag some consumer electronics deals, landing on TiVo DVRs, as well as Roku broadband set-top boxes and Google TV devices from Sony and Logitech. Striking a Redbox partnership would go a long way to expanding its market clout, but it might not give Redbox the flexibility it desires from a distribution point of view.

Pros: Quick, easy access to a library of 40,000 on-demand titles.

Cons: Somewhat limited CE distribution.

Sonic Solutions

Sonic could be the dark horse in Redbox’s partner hunt; while it doesn’t have the instant name recognition that Walmart or Amazon have, it’s providing behind-the-scenes help to a number of digital storefronts already, including those from Best Buy and Blockbuster. The owner of the RoxioNow video purchase and rental offering already is embedded on a number of CE devices and would be able to turn on a branded Redbox offering pretty quickly. At the same time, a Redbox-branded storefront and content library would be competing directly against similar offerings from other Sonic partners.

Pros: Wide distribution, potential for a quick turnaround on a Redbox-branded storefront.

Cons: Direct competition against other Sonic partners.

Related content on GigaOM Pro: (subscription required)

Tags: - - - - - - - - - - - - - - - - - - - - - - - - - -
Read More...

YouTube Hits 1 Billion Subscriptions: Here Are 7 Geeky Good Ones

YouTube crossed the 1 billion subscriptions mark today and if some of those aren’t yours – you’re missing out. Subscription to YouTube channels is a great way to make use of the service, especially on mobile devices.

Have you got some favorite YouTube subscriptions? I do, and I thought I’d share them here. If you’ve got some good ones to recommend to ReadWriteWeb readers let us know in comments so we can subscribe and watch them while exercising and folding laundry.

Sponsor

Below you’ll find links to and descriptions of my favorite 7 channels on YouTube, along with the company’s new widget that makes it easy to subscribe with a click.

Talks @ Google

Famous authors and others come and speak to Google staff and the videos are run in this channel. Sometimes famous Googlers speak to each other. Good stuff, long videos. For example: Clay Shirky.

Gartner Videos

Garnter is the world’s biggest analyst firm and the company frequently posts interviews with big company execs at conferences. Depending on your perspective, these videos can be very valuable, or very boring with hints of interesting tidbits. Example: Yvonne Genovese Discusses Pattern Based Strategy

The Liam Show

Liam Kyle Sullivan loves shoes and I love him for it.

Lockergnome

Chris Pirillo’s Lockergnome is crazy prolific and not going to change your life – but it’s fun. It’s pretty remarkable how this tech geek has built a publishing empire that may have reached its pinnacle with nearly continuous live streaming video of hiself answering questions and talking about nerdly pursuits.

O’Reilly Media

Everyone’s favorite tech book publisher and event company publishes good videos from events and occasional webcasts. Great for a deep-dive into the most cutting edge web technology.

Porter Novelli

This big firm runs PR for SXSW and hosts all kinds of really interesting smaller technology events. Mobile social media and augmented reality have been recent topics.

Social Data Revolution

Andreas Weigend is a deep thinker about social data online and he scores great interviews on the topic. He’s got a PhD in Physics and was the Chief Scientist at Amazon.com through 2004. His videos are highly recommended.

Steve Gillmor

Steve Gillmor combines years of experience as a tech reporter with great access to leading engineers, executives and thinkers and a willingness to push the envelope far into what the future may (or may not) look like online. His YouTube channel is mostly filled with video of his hour-long weekly show the Gillmor Gang. There are plenty of perspectives not included, but if you’re interested in some of the most innovative perspectives in Silicon Valley, this is a great show to watch.

Those are 7 of my favorite YouTube channels to subscribe to. If This Week in VC and Mixergy had channels on YouTube, I’d subscribe to those there too (there’s still iTunes!).

Update: Leo Laport posts explains in comments below that only a fool’s list of geeky YouTube channels would neglect his Twit channel, so check that out. I would be willing to revise the list above and put Twit in place of the Liam Show, but only if Leo is willing to perform the Shoes song himself.

Andrew Warner also pointed out that Mixergy does have some short videos on YouTube as well.

What are your favorites? I think we all could use some more geeky suggestions.

Discuss

Tags: - - - - - - - - - - - - - - - - - - - - - - - - - - -
Read More...

YouTube Tests Live Video In Home Page Banner Display Ad

YouTube has been experimenting with live video more and more in recent months.  And I’m not just talking about live concerts.  Just last week, they partnered with Conan O’Brien to host a 24-hour live video stream from his talk show offices to help promote the show’s launch November 8th—the best bits from the broadcast were [...]

Tags: - - - - - - - - - - - - - - -
Read More...

How to Build An Audience For Niche Web Video Series

We recently caught up with the producer and host of the popular Web series VendrTV on Next New Networks. The show is attracting an audience of 200,000 and Daniel Delaney shared his thoughts on building an audience, honing in on a niche and the real value that a Web video series can provide for its [...]

Tags: - - - - - - - - - - - - - -
Read More...

Access

[+] Portal Login:

  • Manage your hosting account and web services

[+] Portal Register:

  • Create your Free account

[+] Blog Login:

  • Login to our Blog

[+] Blog Register:

  • Create your Free account Blog account

Tags: - - - - - - - - - - - - - - - - - - - - - - - -
Read More...

Apple seeds iOS 4.1 SDK as app downloads top 6.5 billion

Hot on the heels of last week’s Apple (NASDAQ:AAPL) media event touting the Sept. 8 release of the iOS 4.1 software update, the computing giant seeded the iOS SDK 4.1 Gold Master to registered developers, promising the introduction of new services as well as a host of bug fixes. iOS 4.1 is highlighted by the launch of Apple’s long-awaited Game Center service, enabling developers to more effectively incorporate multiplayer gaming tools into their applications–available as both a set of APIs and as a stand-alone iPhone application, Game Center also features social media tools, making it easier for consumers to discover new titles as well as live opponents. According to Apple CEO Steve Jobs, iOS devices now outsell mobile gaming units from traditional videogame giants like Sony and Nintendo.

Also new in iOS 4.1: High Dynamic Range photo capabilities, which Jobs said can combine several different photos, taken quickly together, to produce clearer images. He said the platform also will enable users to upload HD video over WiFi, rather than requiring users to plug their device into a computer. iOS 4.1 additionally fixes bugs impacting the iPhone 4′s proximity sensor, Bluetooth capabilities and the performance of the iPhone 3G–users have complained that iOS 4 slowed iPhone 3G devices. Jobs said Apple will unveil iOS 4.2 in November, touting iPad additions like multitasking and folders.

Jobs said Apple has now shipped 120 million iOS devices and activates 230,000 new devices every day, adding the latter figure doesn’t include upgrades–a not-so-subtle jab at rival Google, which recently said it activates 200,000 new Android devices a day. (“The Android activation numbers do not include upgrades and are, in fact, only a portion of the Android devices in the market since we only include devices that have Google services,” Google told Fortune in response to Jobs’ comment.) Apple’s App Store now offers consumers their choice of more than 250,000 applications–downloads from the digital storefront total 6.5 billion.

For more on the iOS 4.1 SDK:
- check out the iOS Dev Center

Related articles:
Apple issues iOS 4.1 beta update to developers
Apple adds iOS 4 application section to App Store
Apple issues iOS 4 update to iPhone 3GS and iPod touch
Apple now accepting iOS 4 app submissions

Tags: - - - - - - - - - - - - - - - - - - - - - - - - - - -
Read More...

Palm’s webOS 2.0 SDK touts new Synergy APIs

Palm unveiled the first release of its webOS 2.0 SDK, available for download here to all registered members of the device maker’s Early Access developer program. Chief among the enhancements in webOS 2.0: APIs for Palm Synergy, which automatically brings together user information like linked contacts, layered calendars and combined messaging into one single, integrated view. Developers can now merge their applications with the Contacts, Calendar and Messaging services, with other webOS data types on tap. The revamp also features Stacks, described by Palm Developer Community manager Chuq Von Rospach as an evolution of the multitasking card-shuffling metaphor introduced in webOS 1.0–the new operating system groups related cards in stacks, effectively reducing clutter and simplifying toggling between tasks.

In addition, webOS 2.0 boasts Just Type, a renamed and revamped Universal Search tool making it easier for users to update their social network status, set reminders and complete other in-app tasks. Also new: Exhibition, which introduces a special full-screen mode optimized for passive enjoyment and utility when devices are docked. “A handful of compelling Exhibition options will be built into webOS 2.0, but we’re counting on you and your fellow developers to make Exhibition truly great,” Von Rospach writes. “You can add Exhibition support to an existing app, or build something new just for Exhibition.”

webOS 2.0 additionally builds in the Node.js runtime environment, offering developers the flexibility to build services in JavaScript. The OS also adds a host of HTML5 features and enhancements. “These are just the highlights,” Von Rospach notes. “We’ve added a lot of features that will give your apps more power and flexibility than ever.” Palm is scheduled to release webOS 2.0 sometime during the remainder of 2010.

For more on the webOS 2.0 SDK:
- read this Palm Developer Center Blog entry

Related articles:
Palm
to release webOS 2.0 ‘later this year’
Palm
issues webOS 1.4.5 update for Pre and Pixi
HP promises to expand webOS platform post-Palm deal
Palm
launches 3D games on webOS

Tags: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Read More...

Microsoft issues Windows Phone 7 to manufacturers

Microsoft released its forthcoming Windows Phone 7 operating system to its manufacturers, a benchmark described by Windows Phone Engineering corporate vice president Terry Myerson as “the biggest milestone for our internal team.” According to Myerson, WP7 represents the most tested mobile platform in Microsoft history–almost 10,000 devices ran automated tests each day, with over half a million hours of active self-hosting use, more than 3.5 million hours of stress test passes and 8.5 million house of fully automated test passes. “We’ve had thousands of independent software vendors and early adopters testing our software and giving us great feedback,” Myerson notes. “We are ready.” Microsoft is slated to release the final version of its Windows Phone 7 Developer Tools on Sept. 16, enabling developers to recompile their WP7 applications and games prior to the early October relaunch of the Windows Phone Marketplace storefront.

Microsoft will spend about $400 million to promote the launch of Windows Phone 7 according to Deutsche Bank analyst Jonathan Goldberg, adding his forecast doesn’t include the millions the software giant has already committed to pay its handset manufacturer partners to offset non-recurring engineering costs. Goldberg derives his estimate based on conversations with Microsoft brass during a recent visit to the company’s Redmond, Wash. headquarters, with execs anticipating that overall spending will reach billions of dollars once its operator and manufacturer partners’ marketing spending is factored into the equation. TechCrunch adds that according to another source, Microsoft will invest more than a billion on WP7′s launch, half of promotion and half on other development costs.  ”This is make-or-break for them. They need to do whatever it takes to stay in the game,” Goldberg says. “It’s still wide open. They don’t have to take share from Android or Apple, so long as they can attract enough consumers switching from feature phones.”

In July, Microsoft confirmed reports it is offering financial incentives to developers to stir interest in new WP7 applications, with senior director of mobile services and developer product management Todd Brix telling Bloomberg the company is providing everything from free tools and trial handsets to software development funding, even offering revenue guarantees in the event apps fail to sell as expected. Brix declined to state how much Microsoft will spend to woo developers to WP7, but said it is a larger sum than the company invested in previous compensation programs. “We are investing a lot to attract developers big and small to Windows Phone 7 to let them understand what the opportunity is and provide as many resources as we can to help them be successful on our platform,” Brix said. “We’re open for business and we want to work with them.”

For more on the Windows Phone 7 RTM:
- read this Windows Phone Blog entry

Related articles:
Analyst: Microsoft will spend $400 million to market Windows Phone 7
Microsoft paying developers to build apps for Windows Phone 7
Microsoft adds new web experiences to Windows Phone 7     
Windows Phone Marketplace adds private beta distribution
Microsoft
cuts Windows Phone Marketplace app submission fees

Tags: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Read More...

Report: European operators mulling common mobile OS

European operators Orange, Deutsche Telekom, Telefonica and Vodafone are slated to meet next month in Paris to discuss the possible development of a common mobile platform designed to fend off mounting threats from rival operating systems like Apple’s (NASDAQ:AAPL) iOS and Google’s Android. French newspaper Le Figaro reports France Telecom-Orange CEO Stephane Richard has invited the heads of the three competing operators to meet Oct. 8 to explore the creation of their own common OS–the report states the talks are motivated by a belief that iOS and Android are “Trojan horses” enabling Apple and Google to establish their own relationships with consumers, effectively minimizing the carrier’s role in the mobile services value chain. Le Figaro notes the operators are still determining what form an alliance might take, with options including the formation of a joint venture or the construction of a common application development platform. Orange, Deutsche Telekom, Telefonica and Vodafone boast a combined subscriber base totaling around 1 billion.

All four operators involved in the discussions are also members of the Wholesale Applications Community, a GSM Association-organized industry initiative created to simplify mobile software development and distribution. Formally announced in February 2010, the WAC encourages open standardized technologies, driving scaled deployment of those technologies and providing complementary commercial models in an effort to enable developers to efficiently deploy apps across a host of devices and carrier networks–the organization also will facilitate developer payments for content sold through an associated application store.

For more on the common OS negotiations:
- read this GSMA Mobile Business Briefing article

Related articles:
With an eye on application revenues, WAC operators announce business model
WAC pledges to be ‘open for business’ by next year 

Tags: - - - - - - - - - - - - - - - - - - - - - -
Read More...