On our current version, the post excerpt displays everything leading up to the 'more' tag that's manually written into the wordpress post... But inside of the current toolset layout, I can choose 'post content' or 'post excerpt'... Post content displays the entire post, which I don't want... and Excerpt cuts off after a specific number of characters or words that I can choose... Which, of course just cuts the post randomly rather than at a strategic 'get-the-reader-to-want-to-click-read-more" spot. It also loses all formatting/spacing/paragraphs, so it looks terrible if you do any more than a sentence or two worth of content.
How can I duplicate the current setup vs. the hard character/word cutoff? I've added the 'read more' option inside the block editor, which references that it will show all the content up to the 'read more' tag as the excerpt... but it doesn't seem to be functioning that way... and the read more button isn't showing up on these posts, at all, even if I choose the 'excerpt' display option... I'm assuming I've chosen the wrong element or a wrong setting inside that element - but I'm not sure what to choose, instead.
Hi Sean,
Thank you for contacting us and I'd be happy to assist.
Your observation is correct and our post content or post excerpt functionality doesn't support the WordPress default "read more" tag for a cut-off point.
You're welcome to submit this as a feature request at:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
For now, a workaround can be to register custom shortcode that returns the content before the read more tag
add_shortcode('get_content_before_more', 'get_content_before_more_func');
function get_content_before_more_func() {
// get current post's content
$content = get_post_field( 'post_content', get_the_ID() );
// Get content parts
$content_parts = get_extended( $content );
// Return only the content before the read more tag
return $content_parts['main'];
}
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file.
After that, you'll be able to use this new shortcode in your template like this:
[get_content_before_more]
I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
regards,
Waqar
Thank you for this suggestion!
I've installed the code into the functions.php file - but can you tell me where I would insert the shortcode? I've created an an entire custom Toolset archive layout to display our posts on the home page of our site... and everything is finally working perfectly except for not displaying all the content before the 'read more' tag -- and I'm just not sure how to actually replace what Toolset is generating with this shortcode, instead. You mentioned I could use the code 'in the template' - and I do know how and have done that type of work when I've worked with templates or made my own... but isn't the toolset archive block already overwriting/replacing that portion of the template with the toolset layout? So... that leaves me at a loss of where I should put this... since editing that part of the template would be overwritten by Toolset, anyway. I hope I'm phrasing that correctly - does that question make sense? And am I understanding how Toolset is working correctly in this instance?
Thanks for writing back and I apologize for the confusion.
From the template, I meant the template or loop item in the WordPress Archive that you've created using the Toolset.
When you'll open that WordPress Archive for editing, you'll see a "WordPress Archive Loop" among the other blocks.
There will be a block that will be responsible for showing the post content or excerpt.
You can remove that block and in its place add a "Shortcode" block and then place the newly registered shortcode, in it, as shown in this screenshot:
hidden link
Please let me know how it goes and in case it doesn't work, you're welcome to share a screenshot of how and where you've included this shortcode.
That makes sense!
Ok -- so... I went in and added the shortcode block. But I didn't delete any of the others... Just wanted to see what would happen.
And it replaced the old text with the proper full text (before the 'more' tag)... but there's no 'more' button. I do have the 'read more' tag showing under that shortcode inside the toolset layout...
I just noticed it introduced a new issue, though: It bumped the right-side menu bar down to below all the content-posts. Even if the browser is expanded to full size.... No idea why that would be.
We're *almost* there - but I must have left something out... thanks for your help, so far
Update:
I completely deleted and re-created the template... everything works perfectly in regards to the menu column on the right... until I put in the shortcode. As soon as the shortcode is saved, then the menu kicks down below the post.
Thanks for the update and glad that it works.
The issue that you mention is strange indeed. Can you please share temporary admin login details, along with the link to the page where this issue can be seen?
Note: Your next reply will be private please make a complete backup copy, before sharing the access details.
Thank you for sharing the admin access.
During troubleshooting, I noticed that in the content of your post "Making Memories in the Mess", a div tag is opened before the read more tag, but is closed after it.
Screenshot: hidden link
As a result, the opening div tag makes it into the homepage's archive when the new shortcode is used to show the content before the read more tag, but its closing div tag is missing, which breaks the page's layout.
Tip: To view to actual HTML code, you can either use the "Edit as HTML" option from the block's settings ( hidden link ) or switch to "Code editor" from the editor's main options pane ( hidden link ).
To avoid this, it is important that when using a manual read more tag in the post's content, place it carefully so that the content before is properly balanced in terms of HTML tags.
I hope this helps.
Nice! So, removing the div tags did fix it, and the excerpt is displaying properly with the shortcode, now... but I have the 'more' tag in the toolset template after the shortcode, and it still doesn't display the 'more' link to see the rest of the post.
How do we add that? And then I should be good to go, for now 🙂
Thanks for the update.
The "More" block that you've added in the archive template is equivalent to the read more tag that you've already placed in the content of your source posts, so it is not needed here.
For "Read more" link to the full post, you can simply place a Toolset's "Button" block and link it to the post's URL.
( screenshot: hidden link )
This will give you full control over the design of this link/button through that block's "Style Settings".
( screenshot: hidden link )
My issue is resolved now. Thank you! You are awesome!!!