Support » Plugin: Expander » Change text on Open?

Viewing 15 replies - 1 through 15 (of 22 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;
    }

    I was also looking for a solution to the read more, read less (once opened) – is there a way to do this?

    What following function? Where? in custom functions or Plugin functions?
    AND why would I do that? Shouldn’t the plugin be updated to include this in the first place?

    Ciprian

    (@butterflymedia)

    @frank Gomez, give me an example of CSS styling so I know how to implement it.

    I will also update the plugin to add a customizable “Less” parameter.

    @iamnotadoll, thank you for your function.

    I think I was thinking that the part expanded would have a different look or something…
    div.wpex_div{
    background:rgba(255, 255, 255, 0.2)
    }
    Of course I realize that this probably won’t work on every site because site might have a different color background and so maybe you should leave it alone, I can do this with custom css anyway.

    BUT YES, I would love adding the “Less” parameter.

    Ciprian

    (@butterflymedia)

    You got it, I’ll add it tomorrow.

    I understand what you say regarding the CSS div change, and I could implement a custom CSS area.

    If you’re proficient with CSS, you can add it directly to your style.css file, as it’s not a general rule, as you said.

    Ciprian

    (@butterflymedia)

    Plugin has been updated and a “Less” option has been added to the shortcode. Plugin is smaller now and has better performance.

    Don’t forget to rate it!
    Cheers!

    Can you double check this it isn’t working on this site: http://gentlestorm.com/other-media-related-services/

    I’ll leave it “broken” for a short time in case it helps you.

    If I click on More… it just switches to …Less (what I wanted it to say but the hidden part isn’t hidden.

    I removed the short code, looking forward to your reply.

    Not working on my site either.

    Ciprian

    (@butterflymedia)

    @frank, Hi, could you re-add it as I’ll be online all day and I need to check it on your site.

    It works on my dev test, so it must be some JS bit that does this and it’s easily fixable, but I cannot reproduce it.

    @mtyaron, do you have a live site?

    yes i have (ism.technion.ac.il) but i reinstalled an older version of the plugin till it will be fixed.
    If you want i can put the new version again.

    Ciprian

    (@butterflymedia)

    @mtyaron, I’d like you to put up the new version.

    I’m here.

    updated

    Ciprian

    (@butterflymedia)

    OK, I think I know what the problem is. I should change a [paragraph] tag into a [div] tag.

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Change text on Open?’ is closed to new replies.