New - Quick Summary Plugin

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

  1. Go to your Dashboard
  2. Hover over the Plugin section at the left-hand side and select Add New
  3. Click Upload Plugin
  4. Choose Quick Summary Zip File and Select Install
  5. 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 :wink:

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.

10 Likes

Perfect timing.

I was going to do something similar to fit in with a recent addition I did for the FeatherLite theme - an action to add extra content below the post title.

Saved me time with this :slight_smile:

P.S. Sent you a PR with some minor tweaks.

4 Likes

Ha, nice one. Looks neat! Merged!

4 Likes

Isn’t that built-in, with excerpts? You just have to output it in the template.

I agree, this can be done with excerpts… on the other hand, there’s no harm in dropping a supportive comment when members learn something new or create something for the first time. Try to remember back to when you got started… a little support goes a long way.

7 Likes

It would be useful to provide a TL;DR while using the excerpt for archives.

2 Likes