Change layout of specific recent posts elements

Hi there,

on my page I’m using several recent posts elements.

A) Is there a way to have specific recent posts elemets with a horizontal layout (left side:featured image, right side: headline & excerpt)?
But at the same time I want to keep the classic layout for other recent posts elements.
Can I achieve it by assigning different classes?

B) I found a piece of code here to add an excerpt to the recent posts element.
It works on standard pages but not added at the end of a single post.
There the element looks like it wasn’t changed at all. How can I change it at that position, too?

Thank you

Hi,

  1. You can add a unique class to your recent post element.

Then use it in your css code to make horizontal layout.

eg.

.x-recent-posts.my-posts .x-recent-posts-img {
   width:30%;
   margin-right:30px;
   float:left;
}

.x-recent-posts.my-posts  .x-recent-posts-content {
     padding-top:0;
}
  1. In your x_add_social_sharing code in functions.php

Change this line

echo do_shortcode('[recent_posts count="3" orientation="vertical" category="beliebte"]');  

To

echo do_shortcode('[x_recent_posts count="3" orientation="vertical" category="beliebte"]');  

Hope that helps.

Hi there,

we are almost there!


Somehow the whole excerpt is a link.
But it’s supposed to be normal text with a “Weiterlesen” (“read more”) link underneath.
How do I achieve this?

Thank you

Hello There,

Actually the whole recent post item is wrapped with a link. The featured image, excerpt and the title is inside this link. This is why as you have seen the whole excerpt is a link. Modify this would mean modify the recent post element as a whole from the structure up to the styling. Regretfully this can not be considered a custom development. Please keep in mind that our support only supports getting set up, bug fixes and minor cosmetic changes. Any modification that changes the structure or complete recode is already beyond the scope of our support.

Thank you for your understanding.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.