[Resolved] Combine Excerpts and Full posts?

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Combine Excerpts and Full posts?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #22925
    Simon
    Participant

    Hi Tom and team

    (I’m using GP Premium, Generate Blocks, WP Show Posts and Simple CSS, alongside CodeSnippets and Restrict Content Pro. So I’m using GP Elements for Headers and Hooks, etc. As I’ve said before, all the GP stuff is completely brilliant, thank you, as are your forums for finding further information.)

    I’m using WP Show Posts as the primary means to display categories of posts on a site. (Currently 12 categories, but will be 20.)

    Each category has a page, and two or more medical professionals will be posting for it. They select their category when posting. Their page has the WPSP shortcode to display their posts.

    I have set the ‘Read more’ button for ‘Aside’ posts to display:none. That usefully avoids the button appearing on short posts when there is no more to read.

    Originally I set each WP List to ‘Excerpt’ and 50 words. So people had the choice of creating an ‘Aside’ of max 50 words, for an announcement for example, or creating a ‘Standard’ post with a button and link.

    That worked well.

    However in the trial, people didn’t like the lack of formatting in the excerpt. It makes the short posts too limited, without line breaks, links, bold or italic. (I understand why that is unavoidable for an excerpt.)

    Under pressure, I have now set all the lists to show ‘Full’. That’s great for a short ‘Aside’, with no link button. However… of course it means that as soon as they write a long post, the long post will display in Full in a column on their page, rather than being a neat Excerpt+link.

    So I want to ask… is there some way of enabling those posting to select whether an individual post will display as an Excerpt+link, or in Full?

    That could perhaps be triggered by their choice of ‘Aside’ or ‘Standard’ or another Post Format? Or by a tag?

    The only way I can think of (which I have trialled) is to create two categories for each category page, with separate WPSP lists, one list set to Excerpt and one to Full. But the page then needs both shortcodes, so one list follows the other. That means the useful date order is lost. It will also create an off-putting list of 40 categories for people to select from…

    Is there any better way to enable this choice for the user? I’m hoping you might have a bit of brilliant PHP. Or have I missed something and should set it up differently?

    It’s all about to go live, so I would greatly value your advice.

    Thank you and best wishes.

    #22935
    elvin
    Moderator

    Hi,

    So I want to ask… is there some way of enabling those posting to select whether an individual post will display as an Excerpt+link, or in Full?

    Unfortunately, this isn’t within the default functionality of WPSP.

    However, the ones posting, in a sense, can choose what will be displayed depending on whether they put something on the excerpt field.

    WPSP when set to display “Excerpt”, will display “Full post” if excerpt field from the post is left empty.

    That said, If the user doesn’t want the excerpt to display, just leave it empty so WPSP displays full post. And if the user wants excerpt mode, then that’s the only time their suppose to write something in it.

    #22948
    Simon
    Participant

    Hi Elvin

    Your suggestion is not correct. When set to display “Excerpt”, WPSP will not display “Full post” if excerpt field from the post is left empty.

    But I’m hoping there is something close to your answer that could be useful, or triggered with some PHP.

    I’ve just trialled it again, both ways:

    WPSP List set to Full: Post shows in full on the page, and ignores a manual Excerpt.

    WPSP List set to Excerpt: Post shows an excerpt, as a single paragraph with no formatting in both cases. (ie If a manual Excerpt is added, it shows it. If no manual Excerpt is added, it just shows an initial excerpt from the text.)

    Post set to two categories, one category with each setting: It does both of the above; neither WPSP setting overrides the other.

    But if you thought the Excerpt did it, is there something else in the setting that could offer a choice for the person posting?

    ie… is there some way of enabling those posting to select whether an individual post will display as an Excerpt+link, or in Full?

    Best wishes

    #23182
    Tom
    Keymaster

    I wonder if something like this would do it:

    add_filter( 'wpsp_settings', function( $settings ) {
        if ( 'aside' === get_post_format() ) {
            $settings['content_type'] = 'excerpt';
        }
    
        return $settings;
    } );

    This way you can set the option to full content, but Aside posts should use the excerpt option.

    Let me know 🙂

    #23434
    Simon
    Participant

    Hi Tom

    Major thank you for engaging with this.

    I trialled the code you suggested. I set up Aside posts, with and without a manual excerpt, with WPSP Lists set to show Full, and with posts long enough to show an Excerpt. (I also deleted all Additional CSS.)

    Unfortunately they still just show Full.

    So I also tried the reverse – in order to keep the idea of an Aside as a short post that can show in Full, with the default Standard as longer, showing Excerpt+Link.

    In this case I set the WPSP Lists to Extract, and adapted the code as below, to make an Aside show in Full (Not knowing the term to use, I tried it with the words ‘content’ and ‘full’):

    add_filter( 'wpsp_settings', function( $settings ) {
        if ( 'aside' === get_post_format() ) {
            $settings['content_type'] = 'full';
        }
    
        return $settings;
    } );

    But the Aside posts still appeared as Extracts.

    So unless I’m missing something, it’s not quite there yet…

    This is beyond my ability, but I’m hoping something might be possible. It would be a great addition to WPSP for the person posting to be able to choose between Full for their short posts, and Excerpt+Link for their longer posts, simply by choosing Aside or Standard.

    (I also looked up excerpt, and saw https://developer.wordpress.org/reference/functions/the_excerpt/ with the <!–more–> quicktag. Is that another route to enable a manual choice?)

    In hope… Thank you and best wishes.
    Simon

    #23534
    Tom
    Keymaster

    Yes, you can definitely utilize the more tag and it should work as well. Have you given that method a try yet?

    Let me know 🙂

    #24993
    Simon
    Participant

    Hi Tom – sorry to delay getting back. Here is our solution in case it is useful for others.

    My original question was: is there some way of enabling those posting to select whether an individual post will display in WP Show Posts as an Excerpt+link, or in Full?

    It took a long time to get to what will seem like the most basic solution. It was perhaps confusing in our case because both WP Show Posts and Restrict Content Pro offer an automated system for excerpts. Ultimately I went back to basics.

    Context: We are using WP Show Posts to display all posts on pages, with its flexible and responsive layout, ranging from 1-3 columns. They are flexible across pages, and look brilliant.

    When originally setting WPSP to display excerpts of their posts, our authors didn’t like the lack of formatting (line breaks, links, sub-headings etc.) on their displayed posts. Hence my original query here.

    The authors saw the few categories where I had set short announcement posts to show in Full (so with formatting) and they wanted that. But then of course they soon posted long posts which didn’t fit on the page, so needed a break and a link to the full post.

    In other words, for each post, I realised the authors had to have
    (a) control on formatting, and
    (b) the choice of whether to show a full short post in the WPSP layout on the page, or just an extract of a longer post with a link to that post.

    The solution:
    1. I set the WPSP list for each category of posts to show the posts in Full, not just an extract.

    2. Yet I also inserted text in the ‘Read more text’ field. Without that, the link button will not show.

    3. I set ‘Aside’ posts NOT to show the ‘more’ / ‘read this post’ link. I also set the post title and featured image in Aside posts not to act as links. (As WPSP’s display of posts already includes whether the post format is ‘Standard’ or ‘Aside’ etc. this is possible with some simple CSS – see below.)

    It means the authors then have control of their posts:

    4. To create a short post without a link, authors just change the post format to ‘Aside’ in the block editor. It appears in full in the WPSP display, without a link. For the website, this achieves the wider priority of avoiding short posts with a link that takes the reader to nothing more than they have already read. (The previous website had lots of those!)

    5. To create longer posts (ie with an excerpt on the page and a link to the full post) the author simply leaves the post format as ‘Standard’. In the block editor, they manually insert the ‘More’ block at the point where they want to end the excerpt and insert the link. Being able to position this manually at a point where the reader will want to read more, helps make posts interesting.

    Hope that helps someone in a similar situation.
    Thank you for helping think it through.

    Two notes:
    With restricted content: In our membership site, authors can make a separate decision about restricting the readership of their post (managed with Restrict Content Pro). If they set the post to members only, all parts of the post will be for members only, including an initial excerpt. If they opt to show an excerpt to non-members, this works equally well on a post that WPSP shows in Full on the page, and a post shown with an excerpt and link.

    With masonry layout: In this display WPSP mode, the browser evidently calculates absolute positions for the posts displayed on a page, so that they fit beautifully together like masonry. Love it! But we’ve discovered that it can make errors and overlap posts in some browsers IF posts contain responsively sized images (other than the featured image) before the ‘More’ break – i.e. in the part displayed in Masonry. Having worked out the cause, it’s now easily avoided with a guide to the authors.

    CSS for the WPSP display of Aside posts without links:

    .wp-show-posts .format-aside .wpsp-read-more {
        display:none;
    } 
    .wp-show-posts-entry-title a,
    .wp-show-posts .format-aside .wp-show-posts-image a {
        pointer-events: none;
        color: var(--head-grey);
    }
    • This reply was modified 6 months, 2 weeks ago by Simon.
    • This reply was modified 6 months, 2 weeks ago by Simon.
    #25030
    Mike
    Participant

    Thanks Simon!

    It occurred to me that experienced WordPress users may be used to clicking on the title to load the full post as an option to the Read more button. I changed the CSS to allow this.

    .wp-show-posts .format-aside .wpsp-read-more {
        display:none;
    }
    
    .wp-show-posts .format-aside .wp-show-posts-image a,
    .wp-show-posts .format-aside .wp-show-posts-entry-title a {
        pointer-events: none;
        color: var(--head-grey);
    }

    I still hope that this issue is addressed in a future release of WP Show Posts.

    #25110
    Tom
    Keymaster

    Thanks for sharing your solution! 🙂

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.