Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Try replacing the following function with this.
    I also changed the shortcodes.

    function wpex_process($content) {
    	$offset = 0;
    	$stag = '[more ';
    	$etag = '[/more]';
    	while(stripos($content, $stag, $offset)) {
    		// string to replace
    		$s = stripos($content, $stag, $offset);
    		$e = stripos($content, $etag, $s) + strlen($etag); 
    
    		// inside data
    		$ds = stripos($content, ']', $s) + 1;
    		$de = $e - strlen($etag);
    
    		// style tag
    		$ss = $s + strlen($stag);
    		$se = $ds - 1;
    
    		$sstring = substr($content, $s, $e - $s);
    		$sdesc = substr($content, $ss, $se - $ss);
    		$sdata = substr($content, $ds, $de - $ds);
    
    		mt_srand((double)microtime() * 1000000);
    		$rnum = mt_rand();
    
    		$new_string .= '<a class="plsreadmore" id="showmore' . $rnum . '" onclick="this.className=\'hide\'" href="javascript:expand(document.getElementById(\'wpex' . $rnum . '\'))"> ... ' . $sdesc . ' </a>';
    		$new_string .= '<span class="wpex_div" id="wpex' . $rnum . '">';
    		$new_string .= '<script>expand(document.getElementById(\'wpex' . $rnum . '\')); expand(document.getElementById(\'wpexlink' . $rnum . '\'))</script>';
    
    		$sdata = preg_replace('^</br>sim', '', $sdata);
    
    		$content = wpex_str_replace_once($sstring, $new_string . $sdata . '<a class="plsreadmore" onclick="document.getElementById(\'showmore' . $rnum . '\').className=\'plsreadmore\'" href="javascript:expand(document.getElementById(\'wpex' . $rnum . '\'))"> ... close </a></span>', $content);
    
    		$offset = $s + 1;
    	}
    
    	return $content;
    }

    Update: adding a blank link to the ‘close’ tag works as it will reload the page.

    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><p class="readmoreinline">'.$debris[1].'<a class="close" href="">(close)</a></p>';
    	return $link;
    }
    
    add_filter('the_content_more_link', pobo_rmi_morelink_filter, 999);

    I don’t get a persistent ‘read more’ link, it just disappears entirely.

    I have modified the files and can get a ‘close’ link at the end, but can’t get the ‘more’ link back afterwards. Just a warning – I don’t know much about js and sort of fudged this together. Anyone got any suggestions?

    Javascript file (pobo_rmi.js)

    var $j = jQuery.noConflict();
    
    $j('document').ready(function(){
    	$j('.readmoreinline').hide();
    	$j('.close').hide();
    	$j('.more-link').click(function(e){
    		e.preventDefault();
    		$j(this).empty().parent().next('.readmoreinline').show();
    		$j('.close').show(); 
    
    			$j('.close').click(function(e){
    	$j('.readmoreinline').hide();
    	$j('.close').hide();
    	});
    	});
    
    });

    read-more-inline.php

    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><p class="readmoreinline">'.$debris[1].'</p><a class="close">close</a>';
    	return $link;
    }
    
    add_filter('the_content_more_link', pobo_rmi_morelink_filter, 999);

    Excellent, thank you!

    Will the new gallery uploader be incorporated into meta box on the edit post/page screen in the next version of Portfolio Slideshow?

    Look under ‘Forums’ in the dashboard, they’re under ‘Ad Units’

    Thread Starter iamnotadoll

    (@iamnotadoll)

    Nevermind, I’ve fixed it.
    Something in my theme stylesheet was overriding the styles I defined in the plugin.
    Fixed by copying the plugin style to my theme stylesheet.

Viewing 7 replies - 1 through 7 (of 7 total)