Recent posts in sidebar via dynamic content string

Hi Themeco Team,

Is it possible to add a list of recent posts with featured image, title, excerpt and button to a sidebar using X/Pro’s dynamic content string or a widget? I tried a “recent posts” widget but it just shows a list of post titles without featured image, excerpt, etc. I would like the recent posts to be more visually appealing.

Appreciate any help you can provide.

Thank you!

Hey @bartenderonduty,

Thanks for reaching out!

We have a built-in element to display a recent post, you may check this one:

image

And if you want to add it in your sidebar, I suggest that you create Global Blocks then add the content inside your global block. After creating a global blocks, it will generate a shortcode and that’s the shortcode you will need to copy and then paste into your sidebar area. For example this one:

image

Hope that helps.

Wow, that is awesome! Not sure how I missed that element.

I’m testing out the ‘Posts (Tiles)’ version… Is there a way to set the number of tiles that populate based on the length of the content in the adjacent column? So for example, if the content is longer, there would be more tiles. And if the content is shorter, there would be fewer tiles.

Also, is there a way to randomly shuffle posts and prevent the current post from displaying in the element?

Hello @bartenderonduty,

Regretfully there is no option to set the number of tiles that populate based on the length of the content. It would require custom development, I would suggest you please contact a developer who can assist you with your concerns or you can subscribe to One where customization questions are answered. Please note we don’t provide custom development support. It is out of the support scope.

For the Post Order, I would suggest you please set the Looper Provider as Query Builder and now set the order from the Order By Random. Please have a look at the given screenshot below.
Test-Page-Builder-Pro (68)

If you have not seen our Looper doc please have a look at it to learn more about how to pull the Post through the Looper.

Hope it helps
Thanks for understanding

Thank you for the guidance. I selected ‘Random’ for the order, however whenever a tile in the sidebar is clicked on, it loads the page but the sidebar stays the same. So the same post is in the sidebar as on the page. Is there a way to get the sidebar to refresh and not show the same post that’s currently being viewed?

Hi @bartenderonduty,

Now we need to investigate the settings of your page and the sidebar for what exactly happening at your end. Can you please share login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password
– Specific Page where you are having this issue.

To create a secure note, click the key icon underneath any of your posts.

Thanks

I added a secure note. Thank you!

Hello @bartenderonduty,

To exclude the current post being viewed from displaying in your Recent Posts items on the sidebar, I would highly recommend that you check out this detailed solution by @Kory in this old thread:

Kindly let us know how it goes.

Apologies for the delay. I tested the proposed solution and the code is being displayed on the frontend.

Can you please take another look?

Hey @bartenderonduty,

You need to copy the code on the frontend and add in the Query String.

After adding the WP Query code, you can now delete the code you added in your functions.php.

To know more about the Looper Providers, you may check this video.

Hope that helps.

OK, that took some trial-and-error but I think I got it. Thank you for your help!

Hey @bartenderonduty,

You’re welcome! If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.

Thank you.