34
I live in a town that thrives on networking. Networking happy hours, conventions, coffees, dinners, lunches, breakfasts...not even birthday parties are safe. A wedding...forget it, only the email contacts will get an invite. I joked with the husband once, during our wedding planning year of bliss, that all of the people on his list seemed oddly like the people I've seen cc'd in emails. Keep in mind that this was not the actual truth.
I am absolutely no good at networking. I don't enjoy pimping myself out to people I don't know. And heaven help you if you don't work directly in politics. "But...my show is a political analyst show...doesn't that count?" Nope. In a city where the question immediately after "What's your name?" is "What do you do?" When I return with "I work in TV" that's it for that conversation. God forbid that person get to the next unknown before you. I imagine their conversation goes something like this:
Random Politico #1: So have you heard about that girl over there? Random Politico #2: No, why...what does she do? Random Politico #1: She's in TV! Random Politico #2: Oh God...you're kidding. Quick, we must act fast to spread the word. All other random politicos must learn of her true identity before she can shake another hand. Random Politico #1: Egads! You're right! Politico Powers Ignite!!!
Yup, exactly like that. That's totally what they say.
So next time I shake your hand, try to hide your super X-Ray vision that will tell you whether I'm a Democrat, a Republican or a journalist.
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
}