34
From time to time, a coworker will sit down and strike up a conversation about anything ranging from Dinosaurs in the Bible to the calorie count on a McDonalds menu.
Today's conversation was no less enthralling...dare I say even quite entertaining. We decided to wax nostalgic on the parental lashings we received as children. You know what they say..."Kids these days just don't get properly disciplined" Now, to each his own, and all that. I'm not about to lay down words about proper parenting. I'm not that qualified. I just enjoy hearing the different...methods...from different parents and households.
I reminisced about the times I pushed the envelope with the smart-alecky things that came out of my mouth. I cringe when I think about the way I used to talk to my mother, the way I used to laugh at my father when he would threaten to spank us (given that dad stopped being taller than me in the 5th grade), but our laughter would dissipate when we would hear the words "Alright fine, I'll go get your mother." But insert parental unit there...for some it was the mom, some it was the dad, the grandpa, the grandma, so on and so forth. Anyway...back to the stories.
There was the time I tried to duck...I was not laughing.
There was the time when...well...let's call him Ted...Ted decided he didn't want to mow the lawn.
There was the time when...Barney...Barney decided to cut the hair off his sister's Barbies, burn their legs off, shove them into the Barbie camper and send the overly populated Barbie camper on a bouncy trip down the stairs. "I got beat with a Hot Wheel Track." -Barney
Yeah, we all have them. Think about it...you got what you deserved didn't you?
35
36
37
38
Save your template, and you have successfully implemented redirection on your Blogger blog.
However, you still need to setup redirection on your WordPress site so that users are redirected to the proper posts.
You need to copy and paste the following code in your WordPress theme’s functions.php file or in a site-specific plugin.
If this is your first time adding code to your WordPress site, then you may want to check our beginner’s guide to pasting snippets from the web into WordPress.
01
function blogger_query_vars_filter( $vars ) {
02
$vars[] = "blogger";
03
return $vars;
04
}
05
06
add_filter('query_vars', 'blogger_query_vars_filter');
07
08
function blogger_template_redirect() {
09
global $wp_query;
10
$blogger = $wp_query->query_vars['blogger'];
11
if ( isset ( $blogger ) ) {
12
wp_redirect( get_wordpress_url ( $blogger ) , 301 );
13
exit;
14
}
15
}
16
17
add_action( 'template_redirect', 'blogger_template_redirect' );
18
19
function get_wordpress_url($blogger) {
20
if ( preg_match('@^(?:https?://)?([^/]+)(.*)@i', $blogger, $url_parts) ) {
21
$query = new WP_Query (
22
array ( "meta_key" => "blogger_permalink", "meta_value" => $url_parts[2] ) );
23
if ($query->have_posts()) {
24
$query->the_post();
25
$url = get_permalink();
26
}
27
wp_reset_postdata();
28
}
29
return $url ? $url : home_url();
30
}