WordPress.org

Ready to get started?Download WordPress

Forums

Site Layout Customizer
Suggestion: Excerpt improvements (5 posts)

  1. Daedalon
    Member
    Posted 2 years ago #

    Thanks for the easy-to-use and customizable plugin. I know have it otherwise neatly set up, but the current settings don't allow to use excerpts that would suit the site in question. These small changes would do the trick:

    1. Respect the Read More tag <!--more--> when choosing the excerpt. In plugin version 1.7, the place to do this could be right before the last closing bracket on lines 1402-1406:
      if (strlen($post->post_excerpt) > 1){
           $t = $post->post_excerpt;
         }else{
           $t = $post->post_content;
         }

      The thing to do is to remove everything from $post->post_content from <!--more--> to the end.

    2. An option to remove hyperlinks from excerpts. This is crucial for example sites that use hyperlinks early in the posts, for example to utilize the auto-embed feature in WordPress 3.3. A single line with a http://youtu.be/... link is turned into an embedded video when viewing the post, but looks out of place as a text in an excerpt.
    3. An option to keep line breaks. Whether the content is poems or more usual pieces of writing, in many sites the formatting of the line breaks is crucial also in the excerpts.
    4. An option to cut the excerpt at the nearest space or line break. In a website where hyperlinks would be acceptable parts of the excerpt, the intent certainly is not to break in the middle of one. In a website that contains poems this would also be needed, because even a long post might not contain a single period.
    5. It might be useful to specify the length of excerpts in words instead of characters. WordPress default is that excerpts are 55 words regardless of their length.
    6. An option to keep some of the formatting. A case website would like to keep all < em > tags in the excerpts. Out of these I listed, this is the lowest priority, and looking at the code it seems like it takes a bit more thought to implement, but in case it is implemented, the best solution could be a checkbox list of which formatting tags to keep.

    These options 2 to 6 could be best to be in context of each layout instead of the overall plugin settings. The excerpt options could be different for layouts that contain posts from totally different categories, for example.

    http://wordpress.org/extend/plugins/site-layout-customizer/

  2. wpcolor
    Member
    Plugin Author

    Posted 1 year ago #

    ty for great suggestions, we r working on some of it

  3. geologist
    Member
    Posted 1 year ago #

    Here is a partial answer to Daedalon's suggestions. Regarding adding "Read More" to the end of each excerpt. Thanks Daedalon, you got me looking in the right general section of the code.

    Here's what I did to add "Read More":

    First, in the plugin dashboard under "Main Options" make sure you choose "Shorten excerpts to closest period" - NO.

    Then go the the php file for the Plugin (sitelayoutcustomizer.php) at about line #1415 you will see this code:

    $cont='...';

    Modify it to this:

    $cont='... Read More'

    You can style your Read More by making it a class something like this:

    $cont = '... <p class="read"> Read More</p>';

    Don't forget to add this new class to your css file.

    Plugin: http://wordpress.org/extend/plugins/site-layout-customizer/

    My Blog Homepage with excerpts:
    http://www.10milerun.com/smallBiz/

  4. Daedalon
    Member
    Posted 1 year ago #

    Looks like that can be used to make the Read More be a link with a small modification for those websites where all of the excerpt is not a link already. Thanks for the share!

  5. altmany
    Member
    Posted 1 year ago #

    Would be possible to add an option allowing excerpts not just from the_excerpt() but also from the_content(), limited by either the excerpt length (which you already have) or the more tag?

    I've seen the posts above that seem to indicate that you can hack the code to do this, but as a PHP newbie I would much rather use GUI options.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic