File Manager / wp-content Search Upload New Item Settings File "db5.php" Full path: /home1/epichome/public_html/wp-content/db5.php File size: 60.67 B (60.67 KB bytes) MIME-type: text/x-php Charset: utf-8 Download Open Edit Advanced Editor Back
/home/pharmacy/www/wp-content/plugins/read-more-inline/read-more-inline.php
<?php
/*
Plugin Name: Read More Inline
Description: Allow users to toggle content following the 'more' link on a page.
Author: Stephen Gray
Author URI: http://www.pobo.org
Version: 0.3
*/

function pobo_rmi_js()
{

    // Register the script like this for a plugin:
    wp_register_script( 'custom-script', plugins_url( 'js/pobo_rmi.js', __FILE__ ), array(), 1, TRUE );

    // For either a plugin or a theme, you can then enqueue the script:
    wp_enqueue_script( 'custom-script' );
}
add_action( 'wp_enqueue_scripts', 'pobo_rmi_js' );

/**
 * This filter gets the content after the 'more' link
 * and places it in a div with a class of 'readmoreinline',
 * which the javascript a) hides and b) adds a toggle to,
 * so clicking the 'more' link alternately shows and hides the extra content.
 * <br>
 * @param $link
 * @return $link with new class
 */
function pobo_rmi_morelink_filter($link){
    global $post;
    $my_id = $post->ID;
     //$spanId = "more-" . $post->ID;
        $post_object= get_post($my_id);
        $content = $post_object->post_content;
        // grab only the stuff after 'more'
        $debris = explode('<!--more-->', $content);

    $link.='</p><div class="readmoreinline">'.$debris[1].'</div>';
    return $link;
}

add_filter('the_content_more_link', 'pobo_rmi_morelink_filter', 999);

?>