Created
August 25, 2016 11:21
-
-
Save joydevpal/cae57440b35a4805f6d2801287d4f3c7 to your computer and use it in GitHub Desktop.
Revisions
-
joydevpal created this gist
Aug 25, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ <?php /** * auto link keywords in post content and excerpt */ function wcs_auto_link_keywords( $text ) { $replace = array( 'wordpress' => '<a href="http://www.wordpress.org">wordpress</a>', 'google' => '<a href="http://www.google.com">excerpt</a>', 'facebook' => '<a href="http://www.facebook.com">function</a>' ); $text = str_replace( array_keys($replace), $replace, $text ); return $text; } add_filter( 'the_content', 'wcs_auto_link_keywords' ); add_filter( 'the_excerpt', 'wcs_auto_link_keywords' ); ?>