Changeset 2042954
- Timestamp:
- 03/02/2019 07:35:59 PM (7 years ago)
- Location:
- striptease/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
striptease.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
striptease/trunk/readme.txt
r1311935 r2042954 4 4 Tags: anchor, excerpt, filter, more-link, navigation, permalink, quicktag, read-more, teaser 5 5 Requires at least: 2.8 6 Tested up to: 4.46 Tested up to: 5.1 7 7 Stable tag: trunk 8 8 … … 42 42 == Changelog == 43 43 44 = 2.1 = 45 46 * Replaced post ID global variable with `get_the_ID` function 47 44 48 = 2.0 = 45 49 -
striptease/trunk/striptease.php
r854903 r2042954 1 1 <?php 2 /** 3 * A WordPress plugin that strips the #more fragments from the end of Read More teaser links. 4 * 5 * @author Guy Fisher 6 * @copyright Copyright © 2019 Guy M. Fisher 7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License 8 * @link https://wordpress.org/plugins/striptease/ 9 * @package StripTease 10 * @version 2.1 11 * 12 * @wordpress-plugin 13 * Author: Guy Fisher 14 * Author URI: https://profiles.wordpress.org/guyfisher/ 15 * Description: Strips the #more fragments from the end of Read More teaser links 16 * License: GNU General Public License 17 * License URI: http://www.gnu.org/licenses/gpl-2.0.html 18 * Plugin Name: StripTease 19 * Version: 2.1 20 */ 2 21 3 22 /** 4 * A WordPress plugin that strips the #more fragments from the end of Read More 5 * teaser links. 23 * Strips fragments from Read More teaser links 6 24 * 7 * @package StripTease 8 * @link http://guyfisher.com/builder/striptease/ 9 * @author Guy Fisher 10 * @version 2.0 11 * @copyright Copyright © 2010 Guy M. Fisher 12 * @license http://www.gnu.org/licenses/gpl-2.0.html 13 */ 14 15 /* 16 17 Plugin Name: StripTease 18 Plugin URI: http://guyfisher.com/builder/striptease/ 19 Description: Strips the #more fragments from the end of Read More teaser links. 20 Author: Guy Fisher 21 Author URI: http://guyfisher.com/ 22 Version: 2.0 23 24 Copyright © 2010 Guy M. Fisher 25 26 This program is free software; you can redistribute it and/or modify it under 27 the terms of the GNU General Public License as published by the Free Software 28 Foundation; either version 2 of the License, or (at your option) any 29 later version. 30 31 This program is distributed in the hope that it will be useful, but WITHOUT ANY 32 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 33 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 34 35 http://www.gnu.org/licenses/gpl-2.0.html 36 37 */ 38 39 /** 40 * Strips the #more-$id fragments from the end of Read More teaser links. 25 * Filters the HTML markup passed from `the_content_more_link` filter in the `get_the_content` function. 41 26 * 42 * Filters the HTML string passed from the_content_more_link filter in the 43 * get_the_content function. 27 * @link https://developer.wordpress.org/reference/hooks/the_content_more_link/ 44 28 * 45 29 * @since 2.0 46 30 * 47 * @global int Post ID 48 * @param string $more_link HTML markup for teaser link 49 * @return string HTML markup with #more-$id fragment stripped off 31 * @param string $more_link_element HTML markup for teaser link 32 * @return string HTML markup with stripped teaser link 50 33 */ 51 function striptease_more_link( $more_link ) { 52 global $id; 53 return str_replace( "#more-$id", '', $more_link ); 34 function striptease_more_link( $more_link_element ) { 35 $the_id = get_the_ID(); 36 if ( $the_id ) { 37 $more_link_element = str_replace( "#more-$the_id", '', $more_link_element ); 38 } 39 return $more_link_element; 54 40 } 41 55 42 add_filter( 'the_content_more_link', 'striptease_more_link' ); 56 43
Note: See TracChangeset
for help on using the changeset viewer.