Posts Tagged ‘tips’

WordPress Tip: Remove a Category from the WordPress RSS Feed

0

I recently setup The Events Calendar WordPress plugin on a few sites for work. The events are added as posts, so they show up in the WordPress RSS feed.

We didn’t want events showing in the RSS feed, this is the code I ended up with:


// Keep events out of RSS
add_filter('pre_get_posts', 'exclude_category_from_feed');
function exclude_category_from_feed($query) {
	if ($query->is_feed) {
		$query->set('cat','-'.get_cat_ID( 'Events' ));
	}
	return $query;
}

Adding that bit of code to the functions.php file for your theme will prevent posts in the “Events” category from appearing in your RSS feed. You can obviously change “Events” to whatever category you want to exclude.

It can be extended too, not just limited to keeping a category out of the RSS feed. For example, to keep a category off the home page or archive pages, you can change this:

if ($query->is_feed) {

To this:

if ($query->is_archive || $query->is_home) {

That’s it! Hope you find it useful.


WordPress Tip: Redirect to Previous Page After Login

9

I work for a group of newspapers here in Iowa. We recently started moving these sites to WordPress. Site visitors must be logged in to view stories. They can see all the stories on the front page, but when they click through to a single story, they see a login form in place of the post/story content.

I needed to redirect users back to the page they were viewing after logging in. So, if a user was viewing a story called “Look at me now”, they’d need to be redirected back to that story after logging in.

To achieve this redirect after login, add the following code to the functions.php file for your theme:


if ( (isset($_GET['action']) && $_GET['action'] != 'logout') || (isset($_POST['login_location']) && !empty($_POST['login_location'])) ) {
	add_filter('login_redirect', 'my_login_redirect', 10, 3);
	function my_login_redirect() {
		$location = $_SERVER['HTTP_REFERER'];
		wp_safe_redirect($location);
		exit();
	}
}

I looked at a number of plugins to do this, but none seemed to offer this functionality.

A bit of searching on Google yielded this post at Taproot Creative. I modified the code on that post to set the redirect location to the referring page, and that was it!

Now users are redirected back to the story/post they originated from.


Tip: List of Voice Commands for Kinect on Xbox 360

9

I came across this list of voice commands for Kinect on the Xbox 360.

I wanted to document them here as well for future reference. I also get quite a bit of traffic related to Xbox 360 stuff, so someone else reading might find it useful.

Please be aware that this is not a complete list. This list mostly covers voice commands that let you interact with the Xbox 360 Dashboard, not specific games. There are, however, voice commands for some apps: Hulu Plus, Last.fm, Netflix, ESPN and Zune.

You need to say “Xbox” before saying these voice commands.

Open Tray (only if there’s no disc inserted) -> Opens Tray
Kinect -> Opens Kinect Hub
Dashboard -> Takes you back to dashboard
ESPN -> Starts ESPN
Zune -> Starts Zune Marketplace
Video Kinect -> Starts Video Kinect
Trailer -> Starts Trailer
Dance Central -> Starts Game trailer
Play Game (disc) -> launches game
Next – > Takes you to next blade
Previous -> Takes you to previous blade
Sign In -> Signs you in
Achievements -> shows lists of achievements
friends -> shows friendslist
Face Id -> starts Face ID
Yes
Cancel
No
Last Fm -> Starts Last FM

Voice Commands In Last FM:

Love -> hearts song
Ban – > bans song
next -> skips song
play -> plays playlist

Voice Commands for Last FM, Hulu Plus, Netflix, ESPN and Zune

fast-forward -> Fast forward a video or song
rewind -> Rewind a video or song
pause -> Pause video or song
play -> Play a video or song
next -> Skip to next video or song
previous -> Skip to previous video or song


If you’re aware of any voice commands that are missing, please leave a comment describing the voice command and I’ll get it added to this page.

UPDATE 1/3/2011:
I just came across the official Xbox Support “How to control your Xbox 360 console by using your voice” page. It doesn’t list all the voice commands listed above, hopefully they will update it with all the voice commands at some point.

UPDATE 1/17/2012:
Martyn Herb left a comment with a tip on how to turn your Xbox 360 off via a Kinect voice command. Before you can turn your Xbox 360 off, you need to say “Go to settings”. Once you’re at the system settings panel, you can then say “xbox turn off” to shut your Xbox 360 down.


Post navigation