Skip to Content

Create a Latest News Module in Solodev

By showcasing your latest news posts, you can significantly increase engagement and help highlight specific pieces of information. Using shortcodes, you can easily integrate with your Solodev News Modules.

Solodev Required

Displaying your site’s latest news is a reliable method to connect to and keep your audience informed. By showcasing your latest news posts, you can significantly increase engagement and help highlight the specific pieces of information you emphasized.

Your custom display module will only be as effective as the content you showcase. In this vein, it’s essential that your latest news display is kept up-to-date. The best way to ensure timely news items are displayed is to make your section is fully dynamic.

It’s a fairly straight forward process to build a news widget within Solodev. Using Solodev shortcodes, you can streamline the code needed which will help simplify the entire process. The following module code will create a widget that is fully integrated with your news calendar. 

This tutorial will presume that you have an existing News Module. Visit our documentation on how to create a news module if you have not done so already. The tutorial will also use Solodev Shortcodes. Visit the documentation on shortcodes if you are unfamiliar with the subject.

Step 1

Identify the ID of your news module. Navigate to your news module calendar and find the associated ID number. Take note of this number.

Module ID

Step 2

Copy and paste the following code to a separate file within your Solodev installation such as “recent-news.tpl”. 

Note: Replace the {{Your_ID}} with the number you identified in Step 1. For example, for the news module identified, we would include the following markup: repeater id="37" limit="0,3" type="calendar" order="start_time desc"

The above shortcode will find all entries for the calendar with the specified ID. It will then order them based upon the “start_time” of each entry, retrieving the next entry based upon a descending method (i.e. start with the most recent and work your way backwards). Finally, the “limit” parameter specifies to start with the most recent (“0”) entry and to stop after retrieving 3 entries. 

Step 3

Download the CSS below and include it with your site's main stylesheet


Step 4

Add “recent-news.tpl” to whatever page or pages you want by adding it via a Dynamic Div.

Dynamic Div

If you've followed all of the above steps, you should now have a latest news module/widget pulling dynamic from your news module in Solodev. Now, anytime you post a new article, its publish date and title will automatically appear within the module. This will help communicate to your audience that there is new content available without you having to track down and modifying existing source code.

In this article, Solodev demonstrated how to add a dynamic latest news module to your website. Customize the style to your unique needs and start adding news articles to your Solodev website. Enjoy!

Scott Madara
Contributions Editor here at Solodev. Want to be featured on the Solodev Blog? Get in touch.
Follow me on Twitter

Sign up to explore

Create an account in seconds and start building today.

Sign up for Solodev
Solodev Logo

©2024 Solodev. All rights reserved worldwide.