Created
May 18, 2015 16:53
-
-
Save zackkatz/9c97c7fa87ff07ff52f0 to your computer and use it in GitHub Desktop.
GravityView: Examples for modifying Shorten Link Display functionality for Website fields
This file contains 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 | |
/** | |
* Examples of how to disable each of the "Shorten Link Display" methods for shortening the displayed URL. | |
*/ | |
/** | |
* Strip scheme from the displayed URL | |
* | |
* http://example.com => example.com | |
* | |
* @param boolean $enable Whether to strip the scheme. Return false to show scheme. | |
*/ | |
add_filter( 'gravityview_anchor_text_striphttp', '__return_false' ); | |
/** | |
* Strip www from the domain | |
* | |
* http://www.example.com => example.com | |
* | |
* @param boolean $enable Whether to strip www. Return false to show www. | |
*/ | |
add_filter( 'gravityview_anchor_text_stripwww', '__return_false' ); | |
/** | |
* Strip subdomains from the domain | |
* | |
* Enabled: | |
* http://demo.example.com => example.com | |
* | |
* Disabled: | |
* http://demo.example.com => demo.example.com | |
* | |
* @param boolean $enable Whether to strip subdomains. Return false to show subdomains. | |
*/ | |
add_filter( 'gravityview_anchor_text_nosubdomain', '__return_false' ); | |
/** | |
* Display link path going only to the base directory, not a sub-directory or file. | |
* | |
* When enabled: | |
* http://example.com/sub/directory/page.html => example.com | |
* | |
* When disabled: | |
* http://example.com/sub/directory/page.html => example.com/sub/directory/page.html | |
* | |
* @param boolean $enable Whether to enable "root only". Return false to show full path. | |
*/ | |
add_filter( 'gravityview_anchor_text_rootonly', '__return_false' ); | |
/** | |
* Whether to strip the query string from the end of the URL | |
* | |
* http://example.com/?query=example => example.com | |
* | |
* @param boolean $enable Whether to enable "root only". Return false to show full path. | |
*/ | |
add_filter( 'gravityview_anchor_text_noquerystring', '__return_false' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment