Created
August 26, 2015 22:21
-
-
Save cliffordp/799201556f8cc9de0f1f to your computer and use it in GitHub Desktop.
q7 --> add rel="nofollow" to a single event's "EVENT WEBSITE" -> "URL:" link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( 'tribe_get_event_website_link', 'beatrice_event_website_rel_nofollow', 10, 2); | |
| function beatrice_event_website_rel_nofollow( $html ) { | |
| // bail if not an HTML link element | |
| if ( false === strripos( $html, '<a ' ) ) { | |
| return $html; | |
| } | |
| // bail if already has 'rel=' in HTML link element | |
| if ( false !== strripos( $html, 'rel=' ) ) { | |
| return $html; | |
| } | |
| // only add rel="nofollow" if we made it this far | |
| $html = str_ireplace( '<a ', '<a rel="nofollow" ', $html ); | |
| return $html; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment