Skip to content

Instantly share code, notes, and snippets.

@sng2c
Last active February 20, 2018 00:36
Show Gist options
  • Save sng2c/de05585d24bbfc78b85f17d3c95d6048 to your computer and use it in GitHub Desktop.
Save sng2c/de05585d24bbfc78b85f17d3c95d6048 to your computer and use it in GitHub Desktop.
WordPress readmore_selectable Plugin for inserting AD
<?php
/*
Plugin Name: Read More Selectable
Plugin URI:
Description: Insert 'wp-read-more' class into span-tags that has 'more-?' id in content.
Version: 0.1
Author: sng2c
Author URI: https://github.com/sng2c
License: GPL2
*/
add_filter('the_content', 'readmore_selectable');
function readmore_selectable($content){
$content = preg_replace('/<span\s+id=([\"\'])more-\d+\1/','\0 class="wp-read-more"',$content);
return $content;
}
?>
@sng2c
Copy link
Author

sng2c commented Feb 19, 2018

place this file to reamore_selectable directory and zip it. Then upload the zip file to wordpress plugin page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment