Apr 15, 20207:24 AM - edited Apr 15, 20207:24 AM
Member
Creating a custom list of selected blog posts
SOLVE
Hi
I am creating a 'related blog posts' area to sit on post pages.
I want to be able to select 3 other blog posts on a case by case basis to sit in this area...I can see how to pull and display the most recent 3 posts in the blog but I want to be able to select posts randomly.
I'm displaying using:
{% set contents = blog_recent_tag_posts('default', 3) %}
{% for content in contents %}
My markup to display the posts..
{% endfor %}
so I guess I need a drop down list in the custom module that accesses blog posts and then to pull an id in to the above contents statement, 3 times or in an array...?
Thanks! that works well...I only wanted one article in the end so I used content_by_id
Is there a way of giving the content editor a drop down list to select blog article by it's name/title? As opposed to them having to cut and paste an ID - I could only seem to get this via the url for the post?
Basically, you just need the user to select the three posts via a custom module page selector or have them copy and paste the post ID into a text field and you could then output those three posts on the page with either of these functions.
Thanks! that works well...I only wanted one article in the end so I used content_by_id
Is there a way of giving the content editor a drop down list to select blog article by it's name/title? As opposed to them having to cut and paste an ID - I could only seem to get this via the url for the post?
oh great Stefen thanks, yes that's a bit more user friendly!!!
If I may ask one final question related to this...this custom module is a snippet in the Blog Post Listing Template ('Blog content' code view). It needs to be here because it is embedded in between other posts.
This means when the end content editor needs to alter it they have to go directly to the module in Design Manager which isn't very user friendly for non tech, has code and settings to dodge etc.
Is there any workaround for this to enable the user to launch and edit module in a more user friendly fashion (rather as you you do in page view)?
@DM2 Probably the best way to solve that is using a global module and using the global module editor since you can't edit blog listing pages directly via the page editor.
Apr 23, 20201:18 PM - edited Apr 24, 20204:36 AM
Member
Creating a custom list of selected blog posts
SOLVE
Just for any one following this thread in the future re-creating the module as a global (it was local before) worked and allowed a better editing experience for the end user in the global module editor (as opposed to design manager).