I said this, sometimes back:
The very next time, I’ll post on CP forum, would be a plugin of my own, that’s my goal!
And here we go. I know it’s really basic ;(
Quick Summary
Post Editor:
Result: (Follow the usage guide below)
A ClassicPress plugin that adds a meta box functionality to the post editor for a quick summary of a post.
Download
or directly
https://github.com/Horlaes/Quick-Summary-Plugin/archive/master.zip
Installation
- Go to your Dashboard
- Hover over the Plugin section at the left-hand side and select Add New
- Click Upload Plugin
- Choose Quick Summary Zip File and Select Install
- When you are done uploading, Activate Plugin and Follow The Next Step Below
Usage
Goto any template part you would like to display the value of the quick summary field, be it content, below your post title, under a featured image, and if you prefer, above the sky
Then, add this:
$summary_title = get_post_meta( $post->ID, 'quicksummary_title', true );
$summary_textarea = get_post_meta( $post->ID, 'quicksummary_textarea', true );
if ( is_singular( get_post_type() ) && '' !== $summary_title && '' !== $summary_textarea ) {
?>
<div class="c-summary">
<p>
<?php echo esc_html( $summary_title ); ?>
</p>
<section aria-label="quick summary" class="article__summary">
<p>
<?php echo esc_html( $summary_textarea ); ?>
</p>
</section>
</div>
<?php
}
else {
echo '';}
If you want to customize the summary box in your post, you can swap the classes for your use cases, e.g., you can change the c-summary
class to something different and style it the way it fits your use case.
Credit:
I learned most of the stuff I knew about coding plugins from William Patton @williampatton, he is a big inspiration to me and @wadestriebel for leading me to the right path.