Created
May 20, 2014 23:05
-
-
Save wjramos/1dcd9576fe553c382d7b to your computer and use it in GitHub Desktop.
Collapsing content widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="east-oakland-expand" class="collapseomatic subpage-expander">See More</div> | |
<div class="subpage"> | |
<?php | |
$page = get_page_by_title( 'Why East Oakland?' ); | |
$content = apply_filters('the_content', $page->post_content); | |
$excerpt = substr($content, 0, strpos($content, '<p>', 1000)); | |
?> | |
<div class="subpage-visible collapseomatic_content"> | |
<?php | |
echo $excerpt; | |
?> | |
</div> | |
<div id="target-east-oakland-expand" class="subpage-hidden collapseomatic_content" rel="partners-expand"> | |
<?php | |
if (substr($content, 0, strlen($excerpt)) == $excerpt) { $content = substr($content, strlen($excerpt)); } | |
echo $content | |
?> | |
<span class="collapseomatic colomat-close" id="why-oakland-expand">Click Here to Close</span> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WordPress text (php) widget to pull page content into collapsible sub-page. Excerpt cuts off at end of paragraph, so preserves text formatting