PostDivider
Back to my WordPress Plugins page
Current version: 1.0
Revision History:
0.1 – made within the functions.php file of the theme.
0.5 – created the plugin, still required $post->post_content to be passed to functions.
1.0 – removed $post->post_content to be passed in.
TODO
- Clean up code
Synopsis
I was a big advocate for using “the_excerpt” for my sites layout, because it allowed me to split up my content and work around my theme. the problem is that using “the_excerpt()” sucks for many reasons:
- The field is HTML only.
- The field is tiny and cannot be re-sized.
- It requires you to break up your most in a less than stellar way.
Enter PostDivider.
Based on an old post of mine, PostDivider allows the user to get the content before and after the <!–MORE–> tag separately. With PostDivider, hooks are provided to allow the Theme to display the text directly (echoing it), or returning the content as a value from the function. If no <!–MORE–> tag is provided, it will return the_excerpt() and the_content() respectively.
How to use
Please note that these functions operate within ‘The Loop‘.
Get text before the <!–MORE–> tag
<?php the_pre_more_text(); ?> – this will display the text automatically.
<?php $content = get_the_pre_more_text(); ?> – this stores the text within a variable.
Get text after the <!–MORE–> tag
<?php the_post_more_text(); ?> – this will display the text automaticall.
<?php $content = get_the_post_more_text(); ?> – this stores the text within a variable.
