Gael Abadin
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [LoadedPress Show More] Hide patchAlso, I noticed your code changes any link’s href attribute inside the tag, turning the link into a “show content” link. How about modifying it only on the links with href=’#show’ or href=’#hide’?
You can see the result here (click on ‘Mostrar Track List’ link at the bottom): https://www.relaxacion.com/best-of-chillout-100-chill-out-hits/
The patch changing this too would be:
--- lwp-showmore_old.php 2011-06-06 12:07:10.000000000 +0200 +++ lwp-showmore.php 2013-05-11 15:53:22.843000674 +0200 @@ -1,69 +1,89 @@ -<?php -/* -Plugin Name: LWP Show More -Plugin URI: https://loadedpress.com -Description: Convert [showmore], [more] shortcodes into an easy to use hidden / expanding content area. Useful for hiding images, long quotes, etc. Also part of the Loaded WordPress system, <a href="https://loadedpress.com">Click here to take a tour</a>. -Version: 0.2 -Author: LoadedPress -Author URI: https://loadedpress.com/ -*/ - -function lwp_showmore( $atts, $content = null ) { - extract( shortcode_atts( array( - - ), $atts ) ); - STATIC $i = 0; - STATIC $j = 0; - $i++; - - if ($j == 0){ - $j++; - }else if ($j == 1){ - $j=0; - } - - $content = str_replace('[more]', '<div class="lwpshowmore" id="showmore_-'.$i.'">', $content); - $content = str_replace('[/more]', '</div>', $content); - - return '<div class="showmore showmore-'.$j.'" id="showmore_ID-'.$i.'" name="showmore_ID-'.$i.'">' . $content . '</div>'; - -} - -add_shortcode('showmore', 'lwp_showmore'); - - -function lwp_showmore_scripts(){ - wp_enqueue_script('jquery'); -?> -<script type="text/javascript"> -jQuery(document).ready(function($) { - $('.showmore').each(function(){ - var showmoreid = ($(this).attr('id')).replace('showmore_ID-', ''); - $(this).find('a').each(function(){ - $(this).attr('href', '#showmore_-'+showmoreid); - $(this).click(function(e){ - e.preventDefault(); - - $(this).fadeOut('fast',function(){ - $('#showmore_-'+showmoreid).fadeIn(); - }); - }); - }); - }); -}); -</script> - -<style type="text/css"> -.lwpshowmore{display:none;} -</style> - -<?php - -} - - - - -add_action('wp_head', 'lwp_showmore_scripts'); - -?> +<?php +/* +Plugin Name: LWP Show More +Plugin URI: https://loadedpress.com +Description: Convert [showmore], [more] shortcodes into an easy to use hidden / expanding content area. Useful for hiding images, long quotes, etc. Also part of the Loaded WordPress system, <a href="https://loadedpress.com">Click here to take a tour</a>. +Version: 0.2 +Author: LoadedPress +Author URI: https://loadedpress.com/ +*/ + +function lwp_showmore( $atts, $content = null ) { + extract( shortcode_atts( array( + + ), $atts ) ); + STATIC $i = 0; + STATIC $j = 0; + $i++; + + if ($j == 0){ + $j++; + }else if ($j == 1){ + $j=0; + } + + $content = str_replace('[more]', '<div class="lwpshowmore" id="showmore_-'.$i.'">', $content); + $content = str_replace('[/more]', '</div>', $content); + + return '<div class="showmore showmore-'.$j.'" id="showmore_ID-'.$i.'" name="showmore_ID-'.$i.'">' . $content . '</div>'; + +} + +add_shortcode('showmore', 'lwp_showmore'); + + +function lwp_showmore_scripts(){ + wp_enqueue_script('jquery'); +?> +<script type="text/javascript"> +jQuery(document).ready(function($) { + $('.showmore').each(function(){ + var showmoreid = ($(this).attr('id')).replace('showmore_ID-', ''); + $(this).find('a').each(function(){ + if ($(this).attr('href')==='#show'){ + $(this).attr('href', '#showmore_-'+showmoreid); + $(this).attr('id','showmorelink_ID-'+showmoreid); + $(this).click(function(e){ + e.preventDefault(); + + $(this).fadeOut('fast',function(){ + $('#showmore_-'+showmoreid).fadeIn(); + }); + }); + } + }); + }); + $('.lwpshowmore').each(function(){ + var showmoreid = ($(this).attr('id')).replace('showmore_-', ''); + $(this).find('a').each(function(){ + if ($(this).attr('href')==='#hide'){ + $(this).attr('href', '#showmore_ID-'+showmoreid); + $(this).attr('id','showmorelink_-'+showmoreid); + $(this).off('click'); + $(this).on('click.hide',function(e){ + e.preventDefault(); + + $('#showmore_-'+showmoreid).fadeOut('fast',function(){ + $('#showmorelink_ID-'+showmoreid).fadeIn(); + }); + }); + } + }); + }); +}); +</script> + +<style type="text/css"> +.lwpshowmore{display:none;} +</style> + +<?php + +} + + + + +add_action('wp_head', 'lwp_showmore_scripts'); + +?> \ No newline at end of file
Viewing 1 replies (of 1 total)