Sticky post not loading in custom loop

I've created a custom page template for my Homepage and 1 other content page. The idea is to list all latest posts and style the sticky posts differently. So I crafted the following code - http://pastebin.com/v5n62BWE

I noticed that the sticky class was missing on these pages, but it was showing fine on the default Blog page template.

Does BeTheme happen to remove the sticky class from normal pages ? Or, is there something I'm missing from the code there.

Comments

  • Hi,

    what sticky feature you mean exactly?
  • edited November 2015
    Wordpress' default sticky function.

    On my custom page template set for Homepage, the post_class didn't seem to generate the sticky class on 2 posts which I had marked as sticky.

    But in the single posts, I noticed the sticky class was added to them.
  • Sorry but we don't know what is wordpress default sticky function. Can you give us more details about this?
  • Wordpress uses the post_class function to automatically add default classes to its posts. One of the classes it adds to a blog post marked as "sticky" is .sticky

    But when I added the post_class to the list of posts in my custom page template, I realize those posts weren't marked as sticky here. However, when I view the single post, it had the .sticky class assigned to it.

    This was why I found it odd that the .sticky class didn't appear on my custom page template when I queried my list of posts.
  • Ok, thanks for this explanation. I'm going to forward this message to programmer and would speak with him about this on Monday.
Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.