Skip to content

Commit 6c6f7c8

Browse files
committed
Issues with the Official Bitly for WordPress and the Jetpack Open Graph Implementation.
1 parent 63b889e commit 6c6f7c8

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

3rd-party/3rd-party.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
*/
77

88
require_once( 'buddypress.php' );
9-
require_once( 'wpml.php' );
9+
require_once( 'wpml.php' );
10+
require_once( 'bitly.php' );

3rd-party/bitly.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/*
4+
* Fixes issues with the Official Bitly for WordPress
5+
* http://wordpress.org/plugins/bitly/
6+
*/
7+
if( class_exists( 'Bitly' ) ) {
8+
9+
if( isset( $GLOBALS['bitly'] ) ) {
10+
remove_action( 'wp_head', array( $GLOBALS['bitly'], 'og_tags' ) );
11+
add_action( 'wp_head', 'jetpack_bitly_og_tag', 100 );
12+
}
13+
14+
}
15+
16+
/**
17+
* jetpack_bitly_og_tag
18+
*
19+
* @return null
20+
*/
21+
function jetpack_bitly_og_tag() {
22+
if( has_filter( 'wp_head', 'jetpack_og_tags') === false ) {
23+
// Add the bitly part again back if we don't have any jetpack_og_tags added
24+
$GLOBALS['bitly']->og_tags();
25+
} elseif ( isset( $GLOBALS['posts'] ) && $GLOBALS['posts'][0]->ID > 0 ) {
26+
printf( "<meta property=\"bitly:url\" content=\"%s\" /> \n", esc_attr( $GLOBALS['bitly']->get_bitly_link_for_post_id( $GLOBALS['posts'][0]->ID ) ) );
27+
}
28+
29+
}

0 commit comments

Comments
 (0)