scriptygoddess RSS Feed
 
 
 
 

Show Hide "more" with WordPress

Here is a plugin for wordpress using the latest version of the "show/hide" script (which lets you include other text inline, as well as opens up the doors to use the same function for comments) as seen here here. (Of course that post was written for MT)

Current Version: v. 1.4
Last Updated: 8/30/04 8:42 PM EST
See Bottom of post for changelog

Installation Instructions:


Step 1:
Download and "install" this plugin.
(ie. right-click and save that file with a .php extension. Then upload it to your plugins directory, which is located in your wordpress folder: wp-content/plugins)

Step 2: (optional)
I made that plugin for my own purposes with the text you see on this site. If you want the text to say something different – then you'll need to modify it.

(There was a step 3 – but it's not neccessary any more in ver 1.2 of this plugin)

Disclaimer: This is my first attempt to hack WP. The disclaimer in the sidebar VERY MUCH applies. I am NOT an expert. Especially when it comes to WP. So, go easy on me ;-)

If you'd also like to do show/hide comments: see this post for ideas on how to edit your wp-comments and/or this post for a seperate file you can upload and use (wp-dropdown-comments.php)

An additional note I'll make here and on the show/hide more (comments) version:
Make sure you have the following in your template! (It's in the original WP index.php template, but if you're creating your own, you may have easily forgotten to include it) :

<?php wp_head(); ?>

That line would go in between your <HEAD> </HEAD> tags.

Change Log
new in ver 1.4
Bug fix for preview on edit post page (in the admin) thanks to Neil Stead

new in ver 1.3
Minor bug fixes thanks to Tormod

new in ver 1.2.2
Took Tormod's suggestions on code clean-up.

new in ver 1.2.1
echo was changed to return
priority added to add filter (thanks Kendra)

new in ver 1.2:
Added "add action" line (as suggested by Tormod) – so now you do not need to change your index template or any other plugins – use "the_content" as you normally would!

156 Responses to “Show Hide "more" with WordPress”

  1. 1
    Sakz Memo » show/hide more plugin:
    [...] 4 show/hide more plugin Filed under: プラグイン — Sakz @ AM 3:24 scriptygoddessから Show Hide “more” with WordPress Version [...]

  2. 2
    not sweet words » Installed my first plugin.:
    [...] irst plugin.

    I finally installed my first WordPress plugin. Nothing major, just the show/hide more text one on scriptygoddess. So far, it seems a l [...]

  3. 3
    Kathy K:

    Thank you! I was going to try to hack that one myself. It probably would have taken me days to get it working (I'm on a steep PHP learning curve at the moment.)

  4. 4
    waterlily:

    I was wondering… instead of putting the javascript in the head tags, could you put it in the quicktags.php file? It's located in wp-admin. If you have applied the wp-grins (smilies), you have to put that code in there, too.

  5. 5
    Alexis:

    I'm so glad you wrote this for WP! I had just fallen in love with this hack on MT and was hoping to find a good one for WP. Thank you, it works great!

  6. 6
    Jennifer:

    waterlily – I admit to not knowing WP inside and out – but I think the quicktags.php is pulled into the ADMIN pages – not your content pages… but I could be wrong.

  7. 7
    melissa:

    Thank you for the hack! After <div id='extText$id' style='display: none'> there needs to be a beginning paragraph tag for the code can be validated.

  8. 8
    waterlily:

    i'm not sure… i just know that with the wp-grins, you have to put some of your code in there… and then you have to put the same code (it's only one line) in edit-post.php and wp-comments.php

    i'm just guessing…

    can't wait to play with this plugin!

  9. 9
    Jennifer:

    melissa – thanks! It's fixed now. :)

    Waterlily – that makes sense – because wp-comments.php gets pulled on pages that show your comments form.

  10. 10
    Matt:

    You can eliminate step 3. Create a function in the plugin file that echoes out that code when called and call add_action('wp_head', 'yourfunction') in the plugin file.

  11. 11
    Mark J:

    Something tells me that the latest exodus from MT to WP is really going to benefit the WP project. I'm definitely looking forward to your contributions. Now… if we could only get Brad Choate to convert. ;-)

    "Hi, Brad… was just wondering if you could convert ALL of your plugins from Perl MT code to PHP WP code… I'll be your best friend!"

  12. 12
    Tim:

    WP just got very lucky. Great to see you here.

  13. 13
    Jennifer:

    Cool! Thanks Matt. I'll do that later tonight :)

    Incidentally, is there somewhere that explains what "add_action" and "add_filter" actually do? My biggest hurdle in understanding everything is that documentation isn't terribly strong. I find myself actually going through the code in order to figure out what everything does.

  14. 14
    reese:

    Just want to chime in and say that I, too, am really happy to see you working on WP. So much so that I'm inclined to send a donation your way (not that I didn't value you before, but this really rocks :) thanks for all your hard work and experimentation. It saves so many of us time, headaches and pain!

  15. 15
    Rayne:

    Yahoo! I've been using the hack and wanted this as a plugin instead so I wouldn't have to modify the regular code every time I update. I couldn't put my brain in gear to figure it out though. I'm so glad you turned it into a plugin!!! Glad you'll be digging into WP. We may end up with some great stuff.

  16. 16
    Jennifer:

    Ok – I updated the plugin and the post. Now you just load it and call the new function! :D

  17. 17
    Cyn:

    I can't get this to work for me. Do I need to put the javascript in the head? I've tried it with and without the javascript in the head and it still won't work for me. When I view source, it doesn't even show it in the source. I thought maybe it just wasn't showing up. Can anyone help?

  18. 18
    Jennifer:

    Two things –
    Make sure you have the <?php wp_head(); ?> in your template (this is in the default template – and it appears after the <HEAD> tag but before the </HEAD> tag.

    As well, make sure you've activated it through the "plug-ins" page in the admin interface…

  19. 19
    mel:

    you so rock! thank you :)

  20. 20
    Mark J:

    Issue:

    Because you are using a different function to display the content of the entry, any plugin which attempts to filter the output of the content of the entry won't work.

    For example, at the bottom of the Google Hilight plugin:

    add_filter('the_content', 'hilite');

    This won't work, because you're not ever calling the_content()… you're calling the_contentshowhide().

    So you'll have to add this line to the bottom of every plugin that is meant to modify the content of your entries:

    add_filter('the_contentshowhide', 'function_name');

    I'm not sure if there's another way around this, but that has worked for me.

  21. 21
    Jennifer:

    Yeah – I don't think there's another way around it – as there is no way to override or redefine an existing function..

    I'll update the post with that addition…

  22. 22
    Charlene:

    I moved one of my other blogs to WP and couldn't be happier with it. So far I have the "Recent Posts" working. Am really glad to see this show/hide. Thank You.

    I miss the Previous /Main/ Next on the individual posts. Going to start playing with that as well.

    Love not having to rebuild.

  23. 23
    Jennifer:

    Charlene – that's really easy to to do – I'll make a post explaining it…

  24. 24
    Sara:

    Thanks for a great plug-in! I need to update the tutorial for the "read more" as it doesn't work with the latest WP version.

    I cannot get the page to validate now that I have this installed though. I have tried everything and I still get these errors:

    Below are the results of attempting to parse this document with an SGML parser.

    1.

    Line 120, column 3: end tag for element "p" which is not open

    The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element beeing used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

    2.

    Line 155, column 3: end tag for element "p" which is not open

    No matter what I do, I have the error, any help would be great! :)

  25. 25
    Jennifer:

    Make sure you have the latest version of the plugin. There was a mistake that caused validation errors the first time I posted about the plugin…

  26. 26
    Sara:

    Yes, I just downloaded it and installed it about an hour ago. :)

  27. 27
    Jennifer:

    Plugin updated with what was causing the validation problem. :)

  28. 28
    Jen:

    This works great, thanks! I was just wondering, were you planning on making a plugin for the "show more comments" feature, or is there an easy way to modify this plugin to do that as well?

  29. 29
    Jennifer:

    It would make sense to combine them (especially since you only need the one javascript function – already being output by this plugin)… I will most likely do that… but honestly, my priority will first be to create a comment subscription feature for WordPress so that I can officially move this blog over. (That is now the one remaining item on my to do list before I can make the switch final)

  30. 30
    Jen:

    Yea that's kinda what I figured. Rather than mess around with it and probably get nowhere, I think I'll wait and see if you work on it. I'm like you–just trying to see if I can get everything working the way it did on MT before switching.

    Anyway good luck with the comment subscription feature! I know a lot of people are very grateful for all your hard work. :)

  31. 31
    Ozguru:

    Hi,
    I am fiddling with trying to get the javascript to work as a wrapper around a comment block section which I have created.
    I am looking at the code on my MT site (from you) and the new WP plugin. I have managed to get things 90% right BUT when I click on the 'show' link, it shows the comments (as it should) and then tries to load the linked page as well. Now I looked at the mouseover text in the browser for both sites (MT/WP) the constructed links look similar so I figure it must be something silly that I am doing.

    Unfortunately the code is somewhat complicated to try and post. I was hoping that (a) you would recognise my stupidity from the description or (b) you would not mind me emailing the relevant section.

    This is all running on my test server (which is not very stable yet). It may be visible at the same location but on port 88. Unfortunately I do not have WP running in production (yet).

  32. 32
    SilverBlue:

    Thank you ScriptyGoddess! I love the "more" plug in. You're awesome!

  33. 33
    Sara:

    Jen, I took the tutorial off of Ten-Sixteen, please update this entry and remove the link, thanks! :)

  34. 34
    catsudon:

    hello jennifer! i'm sorry to sound so clueless with my question but i did everything in your steps, i uploaded the plugin and activated in in wp1.2. how do i actually use it? do i have to edit some code in my index.php? do i have to write some code when i write an post?

  35. 35
    catsudon:

    hello jennifer! i'm sorry to sound so clueless with my question but i did everything in your steps, i uploaded the plugin and activated it in wp1.2. how do i actually use it? do i have to edit some code in my index.php? do i have to write some code when i write an post?

  36. 36
    catsudon:

    got it to work, thank you!

  37. 37
    jackiefg:

    hmmm, I wrote a comment yesterday thanking you for getting this working with the new WP version but I don't see it. I don't think I'm able to comment here.

  38. 38
    tormodh:

    As Matt said earlier: if you add the line:

    add_action('the_content', 'the_contentshowhide');

    just above or below the other line starting with add_action in the plugin, you don't need to change _anything_ in index.php, or any other plugins.

  39. 39
    Joseph Scott's Blog:
    Adding 'More…' To Your WordPress Entries
    Scriptygoddess has four steps to using her WordPress 'more…' plugin. She uses javascript to hide the rest of entry. WordPress also has a built-in 'more…' ability which is a little simpler, but less flexible. The built-in feature may only be …

  40. 40
    Code Novice:
    WP Show / Hide Plugin
    Congrats to my good friend the Scriptygoddess — she created…

  41. 41
    JohnHays.net:
    Time thank Scriptygoddess and others
    Since I use code by Scriptygoddess and other, I would now like to thank Scriptygoddess and the others.

  42. 42
    G'Day Mate!:
    Status Report
    As you may have realised, I am working flat out on the WordPress migration. I have nice coloured comment boxes again. I have pull-quotes. I have blog statistics and a comment leader board. All sorts of features that you have come to know and love. I ev…

  43. 43
    Code Novice:
    WordPress Bookmarks
    A slew of WP bookmarks, plugins, etc. as seen on Scriptygoddess:

  44. 44
    evolution: do the evolution:
    [...] posts" plug-in: I can bump a post up to the top from any date in the past. A "show/hide" plug-in that makes the "Continue reading& [...]

  45. 45
    chattykathy.us » testing show hide “more”:
    [...] July 12, 2004

    testing show hide "more"

    okay, one more to play with. it works!

    chatt [...]

  46. 46
    Standing Tall » WordPressめも:
    [...] reのWP Grinsプラグインを使用。 折りたたみ式「(続きを読む)」: scriptygoddessのShow Hide "more [...]

  47. 47
    my weblog » ¥×¥é¥°¥¤¥ó:
    [...] iled under: General – site admin @ 10:48 1.2¤«¤é¥×¥é¥°¥¤¥ó¤ÇÀßÄê¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¡£ http://www.scriptygoddess.com/archives/2004/05/20/show-hide-more-with-wordpress/ ¼ê½ç¤Ï¾åµ­¥µ¥¤¥È¤«¤égetContentforShowHide.php¤ò¥À¥¦¥ó¥í¡¼¥É¤·¤Æwp- [...]

  48. 48
    seriocomic :. rhetoric » The one with less:
    [...] ve removed the "Read it here" link for those longer posts. This was done using plugin for wordpress that I slightly modifie [...]

  49. 49
    PCÁí¹ç¸¦µæ½ê » ¡Ö³¤­¤òÆÉ¤à¡×µ¡Ç½ÄɲÃ:
    [...] General¡¡ ¤É¤Î¥Ö¥í¥°¤Ë¤â¤¢¤ë¡Ö³¤­¤òÆÉ¤à¡×µ¡Ç½¤À¤±¤É¡¢Jennifer Scriptygoddess¤µ¤ó¤¬ÇÛÉÛ¤·¤Æ¤¤¤ë¥×¥é¥°¥¤¥ó¥¹¥¯¥ê¥×¥È¤Î¤¤¤¤¤È¤³¤í¤Ï¡¢javascript¤Çµ­½Ò [...]

  50. 50
    Benjamin's Forum Site - ¤Ö¤í¤° : EES Àޤꤿ¤¿¤ß¼° ƳÆþ:
    [...] µ¤Ã¤Æ¤ß¤¿¤È¤³¤í¡¢WPJ ¥Õ¥©¡¼¥é¥à¤Îµ­»ö¤ò¥Ò¥ó¥È¤ËƳÆþ¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¡£ ¼ê½ç¤È¤·¤Æ¤Ï¡¢¥³¥Á¥é¤«¤é getContentforShowHide.php ¤Î¥½¡¼¥¹¥À¥ [...]

  51. 51
    Benjamin's Forum Site - ¤Ö¤í¤° : Show/Hide more text Plugin:
    [...] 8230;¡Ë¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢µ­»ö¤¬Àޤꤿ¤¿¤Þ¤ì¤Æ¸µ¤Îɽ¼¨¾õÂÖ¤ËÌá¤ê¤Þ¤¹¡£ ¼ê½ç¤Ï´Êñ¤Ç¡¢¤Þ¤º¡¢¥³¥Á¥é¤«¤é¥½¡¼¥¹¡ÊgetContentforShowHide.php¡Ë¤òÆþ [...]

  52. 52
    WordPress TestSite » 折りたたみ式 :
    [...] estSite 8/8/2004 Filed under: General — site admin @ 12:40 pm こちらから、getContentforShowHide.php ã‚’ã [...]

  53. 53
    Rag'priest:
    Download and install this pl [...]

  54. 54
    Henna blogs ... » Installed some new plugins…:
    [...] can view the text right below the post rather than a separate page accomplished through the Show/Hide more text Plugin Last but not the least after a lo [...]

  55. 55
    moi-carine.com » Wordpress 1.2 Plugins:
    [...] s is, with the next version of WordPress without your needing to upgrade the plugin. o Show Hide "more" with WordPress A pl [...]

  56. 56
    :: silver shores :: » Too jogged to blog…:
    [...] #8220;Would you… study?" LOL, LOL, and double LOL… Man I wish I had the show/hide plugin from scriptygoddess.com up and running right no [...]

  57. 57
    kjmama¤Î²¦¹ñ » ¤â¤Ã¤ÈÆÉ¤à¤Î¥ê¥ó¥¯¤ò¤Ä¤±¤ë:
    [...] Ȥ¦ÊýË¡¡ÊÃí¡§WordPress1.2°Ê¹ß¤Ç»ÈÍѤǤ­¤Þ¤¹¡£¡Ë 1.°Ê²¼¤Î¥µ¥¤¥È¤«¤é¥×¥é¥°¥¤¥ó¤ò¥À¥¦¥ó¥í¡¼¥É¤·¤Þ¤¹¡£ http://www.scriptygoddess.com/archives/2004/05/20/show-hide-more-with-wordpress/ [Download and "install" this plugin.]¤ò¥¯¥ê¥Ã¥¯¤·¡¢¥Õ¥¡¥ [...]

  58. 58
    ±¦¤à¤±º¸¡¡getContentforShowHide.php¤âÆþ¤ì¤è¤¦¡ª:
    [...] ¤¯¤ì¤¿¤Î¤Çµ¤¤òÎɤ¯¤·¤Æ¡¢read more¤ò²¡¤·¤¿¤é¥Ù¥í¡Á¥ó¤È³¤­¤Îµ­»ö¤¬½Ð¤Æ¤¯¤ë¥×¥é¥°¥¤¥ó¤òƳÆþ¡£Jennifer¤µ¤ó¤ÎShow Hide "more¤ò»È¤ï¤»¤Æ¤¤¤¿¤À¤­¤Þ¤·¤¿¡£ ph [...]

  59. 59
    Under African Skies » script changes:
    [...] changes Filed under: This Site  | paperflake @ lunch time i have added the show/hide script from scriptygoddess so it is wokring i just nee [...]

  60. 60
    Population Statistic:
    [...] want, and therefore pretty useless. In other words: WP sucks. Thankfully, there's Scriptygoddess' plugin to make this tag behave the way it shou [...]

  61. 61
    Mental Leavings! » Tweaks:
    [...] er one was to blah. Also, installed a plug in, so the journal loads faster. It is called show-hide-more-with-wordpress by ScriptyGoddess. When I put quiz [...]

  62. 62
    WxGal's World :: Journal:
    Change is here
    Or at least, it soon will be. I have decided that I AM going to switch my blog to WordPress….

  63. 63
    Brian:

    Jennifer, thanks for the great work!

    Unfortunately, I'm getting a Parse error on Line 15. I'm not sure what's going on, because this is a vanilla install of WP 1.2, version 1.2.2 of your plug-in and setting it up so yours is the only plug-in that's activated makes no difference. Help!

  64. 64
    WxGal's World :: Journal:
    Change is here
    Or at least, it soon will be. I have decided that I AM going to switch my blog to WordPress….

  65. 65
    Becky:

    Jen – I just wanted to say thanks for this plugin. I was using your 'show/hide' script on my MT blog. I'm working on customizing my new WP blog and things couldn't be easier with this plugin.

  66. 66
    Ajay - On the Road Again!:
    Blog Enhancements
    Working on hacking this blog to make it better.

    Added Alex King's Clickable Smilies, so that I can add smilies to my post just by clicking on them and you can add smilies to your comments with a single click :grin: (click!)

    Also added ScriptyGod…

  67. 67
    Jennifer:

    Plugin updated to v 1.3 (thanks to Tormod!)

  68. 68
    Tek:

    Okay.. this is now causing me errors which I am sure is due to the fact that I installed the first verison where you had to make the change in index.php.

    Can you tell me what that change WAS so I can put it back so that I can get this new version to work for me please? Thanks!

  69. 69
    kathryn:

    I've installed the most recent version, and all was fine until I went to write a post. I got this message come up:

    Warning: Cannot modify header information - headers already sent by (output started at /home/notsweet/public_html/words/wp-content/plugins/getContentforShowHide.php:112) in /home/notsweet/public_html/words/wp-admin/post.php on line 146

    The post still went through okay though?

  70. 70
    Jennifer:

    That "Can't modify header" type error is usually a copy/paste error. Usually means there must be a space before the <?php or after the ?> in the plugin file itself. Check the file to make sure there are NO SPACES (or even returns) after that last ?>

  71. 71
    Shelby:

    Just an additional note: The "Can't modify header" information can also happen when you have two or more "things" (plugins, etc) that require you to wrap them in <? -and- ?> before the start of <html> – In my case, when I first tried to skin my site when I switched to WP I had code that looked something like this:

    <?
    require_once {'wp-blog-header.php');
    ?>

    <?
    include ('cookiecheck.php');
    ?>

    I had to modify that, because once the very FIRST request is made (in my case, the require_once('wp-blog-header.php'); code) for "headers" you cannot make another request for them.

    I altered the code and it worked fine after that. The end result was this:

    <?
    require_once('wp-blog-header.php');
    include ('cookiecheck.php');
    ?>

  72. 72
    Rachel-G:

    Hi Jennifer,
    First Thank you for the show/hide plug in.
    Here is the bad part that I don't know if you want to solve or not.
    If you have the MarkDown 1.0b4 activated at the same time as this new version of the plug-in, the xhtml does not validate. It did validate with MarkDown 1.0b4 activated and version 1.2.2 of the show/hide. I am not a php person at all, so I can't offer any ideas on why its happening, but I thought you might want to know.
    Again thank you for the plug-in; in a effort to help out I will leave the MarkDown plugin activated with version 1.3 of show/hide activated in case anyone wants to see the xhtml errors.

  73. 73
    Zack:

    I installed your show/hide plugin version 1.3 on my WP nightly build installation and it is generating an error preventing me from loging into or out of my WP installation. Disabling the plugin enables me to login and logout though.

    Warning: Cannot modify header information – headers already sent by (output started at /home/"accountname"/public_html/wp/wp-content/plugins/show-hide.php:110) in /home/"accountname"/public_html/wp/wp-login.php on line 44

    Warning: Cannot modify header information – headers already sent by (output started at /home/"accountname"/public_html/wp/wp-content/plugins/show-hide.php:110) in /home/"accountname"/public_html/wp/wp-login.php on line 45

    Warning: Cannot modify header information – headers already sent by (output started at /home/"accountname"/public_html/wp/wp-content/plugins/show-hide.php:110) in /home/"accountname"/public_html/wp/wp-login.php on line 46

    Warning: Cannot modify header information – headers already sent by (output started at /home/"accountname"/public_html/wp/wp-content/plugins/show-hide.php:110) in /home/"accountname"/public_html/wp/wp-login.php on line 47

    Warning: Cannot modify header information – headers already sent by (output started at /home/"accountname"/public_html/wp/wp-content/plugins/show-hide.php:110) in /home/"accountname"/public_html/wp/wp-login.php on line 48

    Warning: Cannot modify header information – headers already sent by (output started at /home/"accountname"/public_html/wp/wp-content/plugins/show-hide.php:110) in /home/"accountname"/public_html/wp/wp-login.php on line 49

    Warning: Cannot modify header information – headers already sent by (output started at /home/"accountname"/public_html/wp/wp-content/plugins/show-hide.php:110) in /home/"accountname"/public_html/wp/wp-login.php on line 53

  74. 74
    Zack:

    Ooops. Looks like I jumped the gun. I looked at my plugin code in HomeSite and found an extra space after the closing ?>. The plugin works perfectly now after I deleted the space, and I can login/logout now. Thanks for a great plugin.

  75. 75
    Rachel-G:

    Regarding the MarkDown plug-in and the show/hide plug-in being used at the same time:
    After working with Jennifer last night, (read Jennifer telling me what to change and me doing it) the conclusion has been reached that MarkDown, when used at the same time as the Show/Hide script, will make the xhtml invaild due to the fact that MarkDown stips out <p> tags.
    Just so there is no misunderstanding:
    Show/hide without MarkDown will give you vaild xhtml.
    MarkDown without show/hide will give you vaild xhtml.
    Show/hide + MarkDown = invaild xhtml

  76. 76
    Mark J:

    Rachel-G: This should be easy enough to fix. At least… in theory. See, when you make a plugin in WordPress to modify something, like the content of your entry, it has a priority. Priorities range from 0 to 10, and lower numbered functions are carried out first. Jennifer has given her show/hide plugin a priority of 0, meaning that it will be done first. If you open up the Markdown plugin file, you see this at the bottom.

    remove_filter('the_content', 'wpautop');
    remove_filter('the_excerpt', 'wpautop');
    remove_filter('comment_text', 'wpautop');

    add_filter('the_content', 'Markdown');
    add_filter('the_excerpt', 'Markdown');
    remove_filter('comment_text', 'Markdown');

    No priority has been given to the Markdown filter added to the_content and the_excerpt. This means that it has been assigned the default priority of 10.

    What you need to do is assign each of the plugins a new priority. Change the hide/show plugin to a priority of 5 or so, and change Markdown to a priority of 4. You may have to play around with this… if you have multiple plugins modifying the same text, you might have to close your eyes and grit your teeth to visualize the proper flow of the raw text through the filters. But setting Markdown to a lower priority number than Jennifer's plugin should be your first step. If all else fails, you can make a plugin to look for the particular error and fix it (set with a priority of 10, of course). WordPress's wpautop filter doesn't always produce valid code, so I had to make some preg macros to tidy those cases.

  77. 77
    Jennifer:

    I did have her play around with that – but it didn't make a difference. The problem is that MarkDown removes the ending P tag before the "more…" text – places the "more…" stuff inline – and THEN puts the ending P tag. Whether my script is run first or last – it will still do this. When it does this – the code becomes in valid because the drop down more stuff is in a DIV ID which can't live inside a P block.

    Personally – I'm not sure why MarkDown is putting the P AFTER the "more…" text – but I guess it's a personal style issue of the plugin author. To fix it requires a (probably significant) change to the MarkDown plugin directly. (Which I wasn't going to get into) Or a change to my plugin JUST FOR MAKRDOWN – which I didn't want to get into either.

  78. 78
    Mark J:

    Heh… now you know why I have a plugin filled with this crap to fix funky interactions between wpautop, your show/hide script, and other misc stuff.

    $pattern7 = '</p></p>';
    $pattern8 = '</div>nn</p>';
    $pattern9 = '/</div>[s]{0,20}</p>/i';
    $pattern10 = '&#038&59;& ';
    $pattern11 = '</blockquote></p>';

    $text = str_replace($pattern7,'</p>',$text);
    $text = str_replace($pattern8,'</div><!– show more /p fixed –>',$text);
    $text = preg_replace($pattern9,'</div>',$text);
    $text = str_replace($pattern10,'&#038&59;&#038&59; ',$text);
    $text = str_replace($pattern11,'</blockquote>',$text);

  79. 79
    bookmarks:

    show/hide WP…

  80. 80
    Fiona:

    It's probably just something stupid – I have the plugin working and all… but my plugins page (ie the page you activate them on) is all mess up, showing the code that's in the plugin's file on the page. I had this happen before with another plugin and fixed it somehow – but I can't rememebr how! :)

  81. 81
    Fiona:

    Oh and also, when I post an entry now, I get the error

    Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/littlelioness.net/httpdocs/wp-content/plugins/getContentforShowHide.php:101) in /home/httpd/vhosts/littlelioness.net/httpdocs/wp-admin/post.php on line 340

    any clues?

  82. 82
    the lil lioness:
    Age Won't Weary Me
    At what age would you consider someone to be an adult? If you consider yourself an adult now, when did you start thinking that way? Was it at a certain age, such as the legal "adult" age in your state, or was it when you passed certain milestones, li…

  83. 83
    Jennifer:

    Fiona – please see highlighted comments above yours about the "headers already sent" type errors.

  84. 84
    Fiona:

    Cool :) thanks for that :) (I really should learn to read previous comments properly! 0.0

  85. 85
    seriocomic:

    Ooh, I like this plugin…thanks Jenn. :)

  86. 86
    Neil Stead:

    I'm getting a validation error on my page – there is no attribute "onClick".

    Since this seems to be integral to the way showHide works, I guess it must be something I'm doing wrong.

    See: http://www.glug.co.uk/newsite/index.php

    Any help much appreciated!

    Neil.

  87. 87
    Neil Stead:

    Just figured it out… somewhere along the line "onclick got changed to onClick. Sometimes I hate case-sensitivity!

    Neil.

  88. 88
    Mark J:

    Niel,
    Open up the plugin, and search for "onClick".

    Replace all instances of "onClick" with "onclick".

    XHTML requires lowercase.

    <a HREF="test.com">test</> would also generate an error, because it wouldn't recognize "HREF".

  89. 89
    Mark J:

    Sorry, a little late on that one. ;-) Glad you figured it out.

  90. 90
    Neil Stead:

    Arrrrggghhhh! Worked out how the "onclick" got changed to "onClick" – it's Dreamweaver MX, which I've been using for HTML for years. Apparently it won't produce compliant XHTML unless there's an appropriate DTD at the top of the file – even if you've got the "Produce valid XHTML" option selected!!

  91. 91
    Gina:

    I'm having a problem with this. Since I upgraded to Mingus, I can get my open/close comments to work with this plugin, however, show/hide entries won't work. I'm taken to the main page of the post just as if I didn't have the plugin activated.

    I can't figure out why one would work and not the other. I do have the snippet of code between the head tags also.

  92. 92
    Marius Ooms:

    I'm sorry to ask yet another newbie question. I followed the steps. plugin wp_head, etc. What I just don't get and don't seem to find anywhere is how the call the script?

    Instead of , what do I type after the line I want it to showHide?

    I would really appreciate your help.

  93. 93
    Jennifer:

    Marius – you don't need to do anything special. You just use the normal the_content() call, and it will do the hide/show more links for the "more" text.

    Gina – Unfortunately, the plugin doesn't take "customized" text for the link. If someone has a way to do it without modifying the plugin itself, please let me know – otherwise, if you want custom text for the "show hide" link – you'll need to modify the plugin – Line 93 for the "Read more or read more right here" link. Line 99 for the "hide it" link.

  94. 94
    Marius:

    I'm sorry Jennifer, I realize the sidebar disclaimer applies to me, but I so much luv this pice of code, I hope you can bear with me on this.

    I have the_content() call in place as well as the plugin activated. I also made sure the wp_head is in place. However I see no difference on my page.

    oomsonline.com

    I'm also using my-hacks.php. Could that throw off the plugin?

  95. 95
    shurson.net:
    Show and Hide Comments
    I implemented the show/hide feature after taking some time and carefully reading some articles over at Scriptygoddess' website. Thanks, Jennifer!

    Here's what I did…

    1. I went to Scriptygoddess' article and installed her plugin getCont…

  96. 96
    Glenn:

    Love the plugins/hacks. Love your site! You are very talented!

  97. 97
    Felixe:

    Hello, when I activate this plugin I get the following error:

    Parse error: parse error, unexpected T_VARIABLE in /home/mysite/public_html/felixe/wp-content/plugins/getContentforShowHide.php on line 125

    What could be the cause? I reinstalled it several times and checked the code but still nothing.

    Thanks,
    Felixe.

  98. 98
    sam:

    here's my "more" code:

    onclick="showHide($id,'".get_permalink()."',this,'entry');return false;">more

    why isn't the rest of the entry popping up? i get forwarded to the permalink instead

  99. 99
    sam:

    reposted, oops

    <a href='".get_permalink()."' name='ext$id'

    onclick="showHide($id,'".get_permalink()."',this,'entry');return false;">more</a>

  100. 100
    Molly:

    As mentioned by some of the others, I am having the problem of all the code from this plugin showing on my plugins page. Once the plugin is activated, the code from the first half of the plugin also shows on my page, above the title bar. After checking the plugin file and fiddling with a few other things, I am stumped! Any suggestions? I left the plugin activated on my page so it would show what is happening. Thanks for any advice!

  101. 101
    DAWilliams:

    Finallly got the plugin to work and descovered that it breaks post preview in wp admin. Post preview will now only show the title and the catergory. Did the newbie break something again?

    TIA
    DA Williams
    Tech Blog

  102. 102
    Valerie:

    Hey, I tried to go through all the comments looking for this one but I kinda zoned out after 50 or so… ;-)
    Will this slow down the initial loading of my page much, if at all?
    Thanks!

  103. 103
    aline:

    I finally installed your Show More plugin today. So basically, this adds a
    Read more… or Read more right here… » right?
    Is it possible to separate those two? In some of my entries I like the having the first type of Read more only and in others,i like using the 2nd type only. I don't want to give my blog readers the option of choosing one of them.

  104. 104
    Chad Evans:

    Great plugins Jennifer. I'm having a problem with this one in particular though, as well as a couple of others. I have downloaded the plugin and uploaded it to my server as the instructions explain. Before uploading I have cleared any and all white space at the tail end of the script as required for successful use.

    The problem that I have is that when I activate this plugin, the script itself displays at the top of my home page. I have tried trial and error of just about everything on this topic and have yet to find a fix. Any help on this is much appreciated.

  105. 105
    Steven:

    I had the same problem as Chad and others, with the code appearing on my site. I originally installed the plugin by rightclicking the plugin and saving it as a php file, only to have it display a massive chunk of code on my admin and index pages.

    HOWEVER, I installed it a second time by clicking the file to load in my browser, then selecting everything and copypasting it to a new php file. I uploaded it, and the problem was solved. I don't know what exactly caused it, but the most obvious difference between the two files is the lack of coloring and line breaks.

    When using this method, I later got the Cannot Get Header error, which Zack already posted a solution to (make sure all spaces and returns after the last characters are eliminated).

  106. 106
    Neil:

    Jennifer – as mentioned above, the plugin breaks the Preview on the Edit page – the content isn't displayed.

    I'm sure it should be possible to put a check in to see whether the current page is the Edit page, I'm not sure how.

  107. 107
    Jennifer:

    I hadn't noticed the previous comment, nor the fact that this plugin was causing that problem. I will work on fixing it, but due to some personal issues going on at the current moment, it will have to take the backseat. So… it may be a little while before it's fixed… but suffice to say, it's on my radar now. :)

  108. 108
    Jennifer:

    Plugin updated to 1.4 (bug fix thanks to Neil!!) :D

  109. 109
    the lil lioness:
    She's Back?
    Pei's been lurking around in Squeak (gone!) and Journal form……. but it seems the Toothpaste Addict is back! *and there was much rejoicing*

    The show/hide more plugin for wordpress has been updated to

  110. 110
    Leonieke:

    great plugin again!

    but somehow I get xhtml validation errors

    <p><div id='extLink47'>
    = document type does not allow element "div" here

    any ideas?

  111. 111
    Leonieke:

    hmm, nm .. seems there's a conflict with Markdown plugin

    I read your comment a couple of 'comments' ago :)

  112. 112
    Wilhelm:

    problem:

    i installed the plugin , activated it and inserted the line into the index.php, but i get this when i try to post a new entry,

    Warning: Cannot add header information – headers already sent by (output started at /srv/www/htdocs/wp-content/plugins/getContentforShowHide.php:1) in /srv/www/htdocs/wp-admin/post.php on line 146

    did i miss a step, btw it is WP 1.2

  113. 113
    Iva:

    Hey Jennifer, would it be possible to have this plug on individual entry pages as well? I'm building a site with an archive of magazine articles and I wouldn't like comments to appear under the article before they're "opened". Is that possible?

    Thanks:)

  114. 114
    marc:

    I run on WP ver 1.2 mingus and have installed the dropdown "more" plugin.

    In attempting to activate the plugin I receive the following message:

    "Sorry, you need to enable sending referrers, for this feature to work."

    I have checked both my browser and firewall (Zone Alarm) and everything "seems" OK. Any suggestions.

  115. 115
    Neil Stead:

    Marc, this is due to settings in your firewall software, which are preventing your computer from sending information about the previous page you visited.
    If you're using Norton, you can find this on the "Web Content" tab of the Options page.

  116. 116
    Neil Stead:

    Whoops – just noticed you said you were using Zone Alarm, not Norton. I'm pretty sure it's a firewall problem – I've had exactly the same thing with other plugins.

  117. 117
    Mark J:

    It could also be a browser setting. I think some browsers can disble referrer sending. I know that I have problems with referrer sending features in the admin when I use my T-Mobile SideKick's browser.

  118. 118
    marc:

    As per my last post I have solved the referer problem. It was a browser setting. I still haven't found the setting in IE6, but it works when useing Firebird.

    Since activating the plugin I noticed another problem When useing the function in IE6 it work OK. BUT when viewing the page in Firebird and clicking on "read more here," it will monetarly open the extended entry then a couple seconds later the display will shift to the individual entry archive. In other words the same as clicking the "read more" link.

    You can view the results here: Cranial Cavity

  119. 119
    marc:

    In ref to my last (comment #86)I have disabled the plugin. I have discovered that with it enabled I am unable to use the "login" line in the sidebar, or the "edit" link in each post. They both return an error on parsing the plugin.

    Has anyone else had this problem.

  120. 120
    marc:

    Strange:

    Now the "edit this" link works (both in IE6 and Firebird) with the plugin activated.

    But the "login" link in the side bar returns this:

    " Warning: Cannot modify header information – headers already sent by (output started at /home/cranial/public_html/wordpress/wp-content/plugins/showhide.php:119) in /home/cranial/public_html/wordpress/wp-login.php on line 257

    Warning: Cannot modify header information – headers already sent by (output started at /home/cranial/public_html/wordpress/wp-content/plugins/showhide.php:119) in /home/cranial/public_html/wordpress/wp-login.php on line 258

    Warning: Cannot modify header information – headers already sent by (output started at /home/cranial/public_html/wordpress/wp-content/plugins/showhide.php:119) in /home/cranial/public_html/wordpress/wp-login.php on line 259

    Warning: Cannot modify header information – headers already sent by (output started at /home/cranial/public_html/wordpress/wp-content/plugins/showhide.php:119) in /home/cranial/public_html/wordpress/wp-login.php on line 260

    Warning: Cannot modify header information – headers already sent by (output started at /home/cranial/public_html/wordpress/wp-content/plugins/showhide.php:119) in /home/cranial/public_html/wordpress/wp-login.php on line 261"

  121. 121
    marc:

    The above error is also returned when I attempt to access via the normal the login page. (ie enter login and password)

  122. 122
    Valerie:

    Okay I know this is a bit unrelated, but this is the only place I can think of where I've seen this right now.
    I want to be able to do something like this show/hide more but outside WordPress, just in a normal page.
    Do you have any links to point me to? It would be greatly appreciated. Thanks!!

  123. 123
    Jennifer:

    show/hide anything :)

  124. 124
    Jennifer:

    I should add that I haven't gotten around to updating that show/hide anything version of the script to the latest. So until I do – while, it still works, it MAY cause your page not to validate…

  125. 125
    Valerie:

    Thanks, Jennifer! (Please excuse my ignorance) ;-)
    I'm not worried about the validation, I can never validate anyway (besides css) because if for no other reason, I have a habit of doing br instead of br /. lol
    Thanks!

  126. 126
    eRRaTiK:

    I'm blind. How do I actually use this thing? (plugin already installed)

    Can it be configured to automatically place "more…" after a specified amount of text characters?

  127. 127
    Mark J:

    eRRaTiK, click the "more" quicktag, or just type: <!–more–>

    This will set the break point on the main page, but on the individual archive, it'll show the whole thing as continuous.

    P.S. Don't put the "more" before the end of a tag or anything… in fact, it's a good idea to do a line break before and after it just to be sure that the paragraph formatting will look right.

  128. 128
    eRRaTiK:

    right. i officially need to have my eyes checked.

    thanks once again Mark.

  129. 129
    Chelle:

    I'm having the same issue marc is in regards to the header out put. I checked the file for extra spaces and returns, deleted them and reuploaded. I still get the warning for header output in regards to lines 257-261. Any other ideas of conflicts and where to look to modify. I spent a good while trying to troubleshoot, but nothing's working.

  130. 130
    Incoherent Blather:
    Goodbye b2, I'll miss you.
    Well, I've taken the plunge, sorta. Again. Whatever. I've migrated from b2 to WordPress. Let's face it, b2 was defunct. Development had officially stopped, and it was quickly falling behind.

    WordPress offered regular updates, and flexibility…

  131. 131
    Wilhelm:

    i tried it again from scratch and i got it working …. thanks for this plugin !!

  132. 132
    CT:

    Great script! I really wish WP would follow established blogware standards and put things like this in automatically, but this is the next best thing.

    One thing, though: When I click on the "hide" link, the text does scroll back up, but I also get a separate popup of my blog front page. Any way to eliminate this? (I realize popup blockers will kill this, but I want to eliminate it altogether.)

    The only hack I'm made to the getContentforShowHide file is to delete the "Read more or" permalink, and re-worded the "Read more here" and "Hide" links.

  133. 133
    Tony:

    Has anyone found a way to get this plugin to work with markdown?

  134. 134
    Gerry DeOcampo:

    Some people have posted issues about this plugin — the "more" link taking them to the Permalink after briefly displaying the extended entry.

    I'm having the same problem. Has anyone figured out how to resolve this issue?

  135. 135
    Josh London:

    For those of you wanting to change how the 'hide comments' procedure works so the browser does not scroll back up the permalink, I have two options that work on firefox and IE6 and I think are still valid XHTML.

    Open up the wp-dropdown-comments.php and find this line (line 29 if you haven't edited the original):

    <a href="#com<?php the_ID() ?>" onclick="showHide(<?php the_ID() ?>,0,this,'comments');return true;">Hide Comments</a>

    and change it to:

    <a class="hideComs" onclick="showHide(<?php the_ID() ?>,0,this,'comments');return true;">Hide Comments</a>

    You will also need to add the following CSS:

    a.hideComs {
    cursor: pointer;
    }

    This basically removes the href completely and the CSS causes it to behave as if it was a 'link'. Beware if older browser support is important.Use/test at your own risk, just wanted to share my solution.

  136. 136
    JoeBruin88:

    It did not work.

  137. 137
    evening:

    How can I change it to show another saying. So instead of reading "(more…)" it would read "read more…" I tried changing all the references of "(more…)", but it isn't working.

    Also, Gerry, I'd like it so the focus did not change to the permalink, but stayed right where it was on. It worked well on MT.

  138. 138
    Mygly:

    When I use the show/hide plugin in wordpress 1.2.2 in the middle of a sentence, it cuts that part of the sentence and starts whats after <!–more–> on a new line. I'm also having problems with it changing the font after the more line also until I use the <br /> or <p>

  139. 139
    Jennifer:

    The script wasn't designed to be used in midsentence. It would probably take a little hacking to get it to work like you want.

  140. 140
    Mygly:

    Is there a hack or workaround so that the screen doesn't scroll down when you use "hide it"? so that it just stays in the same view as when you clicked it to show? and what is the #ex5 and #ex3 I get when hiding the content? Thank you for such a quick reply by the way.

  141. 141
    Jennifer:

    I think comment #102 will help

  142. 142
    Mike:

    I have wordpress 1.5 installed, and followed your instructions, yet I don't see any way to post where some of my post can be hidden like I could in mt. Is this plugin compatable with 1.5?

  143. 143
    Daisyhead:

    I can't get this to work with WP 1.5 Is it a compatability issue? When I include the header tag, like instructed in the script, I get errors about the header info already being sent out. Any help would be appreciated!

  144. 144
    Jennifer:

    I have actually gotten it to work as is in 1.5. Those "headers already sent" errors are usually tell-tale signs that there is a space before the first <?php or after the last >? in your plugin file that you uploaded. You may not even see it. So make sure there's no extra line returns or spaces in there…

  145. 145
    cw:

    I tried installing it in WP1.5 but my layout loses its formatting. (sidebars end up at the bottom of the page and the main column extends the full width of the window. I've checked for spaces before and after < ?php and after >? and there is nothing. It was working fine in WP1.2.2. What could be the problem?

  146. 146
    Jennifer:

    Sounds like more of a css/html/layout issue. I would suggest viewing source on the page that is displayed in your browser and checking it from there. (Or try validating the page – it may find any unclosed tags – or too many closing tags – you have in your layout)

  147. 147
    cw:

    Thank you. It's working now!

  148. 148
    Baden:

    I really need some help getting the Show Hide plugin working on my WP 1.5 site.

    The part I guess I'm really missing is what file the <?php wp_head(); ?> goes into? My index.php (located under my wp-content/themes directory) has no <head></head> tags so the plugin javascript isn't getting called.

    Any idea where this is supposed to go?

    Baden

  149. 149
    Jennifer:

    If you don't have head tags there – then you probably have a "header.php" file somewhere with your theme… (Although, I'll have to check, because I don't remember – but I think that should be in there by *default*)

  150. 150
    Jennifer:

    "but I think that should be in there by *default*"

    Just to clarify – I meant that the <?php wp_head(); ?> should be in there by default…

  151. 151
    Chelle:

    Just an FYI for anyone using the Miniblog plugin, something tres weird happens when you have that and Jennifer's show hide more plugin.

    For some reason, the mini blog plugin will pull from a WP blog entry as plug it into the mini blogs a few times over. The S/H will function though..it also won't play nice with the nextpage tag either, but I suspect that's something to do with the theme [Wuhan].

    Haven't had much chance to look at it, and I've disabled the S/H plugin until I can see what's what. Just thought I'd mention it, cause I really like the more tag behaving this way than as is.

  152. 152
    Caitlin:

    Great plugin, it took me hours to find it, and of course it's on the most obvious site!

    When I use the "read more right here" option, it doesn't open up inside the same page as it does on your site. Any ideas why this might be? Is that a different script altogether?

  153. 153
    Jo:

    Just installed the read/hide plug in –THANK YOU! Works like a charm. I even went in and took out the Read here or line and had no problems.

  154. 154
    Plugin:Content with show/hide javascript for “more” ã‚’ wp.Vicuna で。(戯言に近い小ネタ) « kappadow.jp:

    [...] Plugin配布元:Content with show/hide javascript for "more" [...]

  155. 155
    WP Plugins DB » Plugin Details » Content with show/hide javascript for "more":

    [...] Visit [...]

  156. 156
    INTERESTIC NEWS » Blog Archive » WordPress???????????(3):

    [...] Google??????????????????????? scriptygoddess » Blog Archive » Show Hide “more” with WordPress [...]

Categories

Archives

Bookmarks

WordPress Resources

Meta

ADVERTISEMENTS