Wordpress plugins
Linkify Text

Linkify Text

Version : 1.8
Tested up to : 4.5.10
Number of download : 11865
Author : Scott Reilly
Average rating : 3.5 / 5 on 11 votes 11 votes, 3.5 avg.rating

Screenshots

Linkify Text
Linkify Text
Linkify Text
Linkify Text

This plugin allows you to define words or phrases that, whenever they appear in your posts or pages, get automatically linked to the URLs of your choosing. For instance, wherever you may mention the word “WordPress”, that can get automatically linked as “WordPress“. Additional features of the plugin controlled via settings and filters: Text linkification can be enabled for comments (it isn’t by default) Text linkification can be made case sensitive (it isn’t by default) Text linkification can be limited to doing only one linkification per term, per post (by default, all occurrences of a term are linkified) You can also link multiple terms to the same link and only define that link once in the settings via use of a special link syntax. Links: Plugin Homepage | Plugin Directory Page | Author Homepage Filters The plugin exposes six filters for hooking. Typically, the code to utilize these hooks would go inside your active theme’s functions.php file. Bear in mind that all of the features controlled by these filters are configurable via the plugin’s settings page. These filters are likely only of interest to advanced users able to code. c2c_linkify_text_filters (filter) The ‘c2c_linkify_text_filters’ hook allows you to customize what hooks get text linkification applied to them. Arguments: $hooks (array): Array of hooks that will be text linkified. Example: /** * Enables text linkification for custom fields. * * @param array $filters The filters handled by the Linkify Text plugin. */ function more_text_replacements( $filters ) { $filters[] = 'the_meta'; // Here you could put in the name of any filter you want return $filters; } add_filter( 'c2c_linkify_text_filters', 'more_text_replacements' ); c2c_linkify_text_comments (filter) The ‘c2c_linkify_text_comments’ hook allows you to customize or override the setting indicating if text linkification should be enabled in comments. Arguments: $state (bool): Either true or false indicating if text linkification is enabled for comments. The default value will be the value set via the plugin’s settings page. Example: // Prevent text linkification from ever being enabled in comments. add_filter( 'c2c_linkify_text_comments', '__return_false' ); c2c_linkify_text (filter) The ‘c2c_linkify_text’ hook allows you to customize or override the setting defining all of the text phrases and their associated links. Arguments: $linkify_text_array (array): Array of text and their associated links. The default value will be the value set via the plugin’s settings page. Example: /** * Programmatically adds more text to be linked. * * @param array $text_to_links Array of text and their associated URLs. */ function my_text_linkifications( $text_to_links ) { // Add text link $text_to_links['Matt Mullenweg'] => 'https://ma.tt'; // Unset a text link that we never want defined if ( isset( $text_to_links['WordPress'] ) ) { unset( $text_to_links['WordPress'] ); } // Important! Return the changes. return $text_to_links; } add_filter( 'c2c_linkify_text', 'my_text_linkifications' ); c2c_linkify_text_case_sensitive (filter) The ‘c2c_linkify_text_case_sensitive’ hook allows you to customize or override the setting indicating if text matching for potential text linkification should be case sensitive or not. Arguments: $state (bool): Either true or false indicating if text matching is case sensitive. The default value will be the value set via the plugin’s settings page. Example: // Prevent text matching from ever being case sensitive. add_filter( 'c2c_linkify_text_case_sensitive', '__return_false' ); c2c_linkify_text_replace_once (filter) The ‘c2c_linkify_text_replace_once’ hook allows you to customize or override the setting indicating if text linkification should be limited to once per term per piece of text being processed regardless of how many times the term appears. Arguments: $state (bool): Either true or false indicating if text linkification is to only occur once per term. The default value will be the value set via the plugin’s settings page. Example: // Only linkify a term once per post. add_filter( 'c2c_linkify_text_replace_once', '__return_true' ); c2c_linkify_text_linked_text (filter) The ‘c2c_linkify_text_linked_text’ hook allows you to customize or override the replacement link markup for a given string. Arguments: $new_text (string): The link markup that will replace $old_text. $old_text (string): The text being replaced/linkified. $link (string): The URL that $old_text is to be linked to. $text_to_link (array): The full array of text and the URLs they should link to. Example: See the “Can I change how the link gets created because I want to add a ‘title’ attribute to the link?” in the FAQ.

Download now