Support » Fixing WordPress » sticky posts not displaying

  • Hello,
    I am trying access one sticky post in my homepage. where one sticky display different (big) and rest displays normally. till now i am able to make this code bt its not working.what could be wrong

Viewing 12 replies - 1 through 12 (of 12 total)
  • esmi

    (@esmi)

    Forum Moderator

    I see that you are using query_posts(). Is this the only loop on the page?

    I think so, because loop surrounds the get_template_part in the index page and within that template part the page is called.does it count as in the loop or not

    esmi

    (@esmi)

    Forum Moderator

    I don’t see any reference to get_template_part in that pastebin code. query_posts() should only be used to modify the main Loop – not any secondary Loops. From the sound of it, you’re using it to create a secondary query before – or within – the main Loop when you should be using WP_Query.

    you didn’t see the template_part as its standard index. i am calling homepage-custom from that loop and the above code is homepage-custom code.

    esmi

    (@esmi)

    Forum Moderator

    Can you drop a complete copy of the relevant template file into the pastebin?

    Basically what i want is the content to display latest post on homepage as a sticky as it has some different css and other to be displayed in other styling which i will define also by css.do you still need the code?

    esmi

    (@esmi)

    Forum Moderator

    Hmmm… you might just be approaching this in the wrong way and over-complicating it. Is this just about adding some extra CSS classes & perhaps some new markup to the latest post? if so, it should be possible to achieve using the main Loop with no need for any extra queries.

    Is the most recent posts always going to use the standard port format? Or could it use any one of a number of supported posts formats?

    This is my approach for homepage the latest post keeps the same big format while other just display a thumbnails and roll over that will show some content of post. i hope you got the idea?

    esmi

    (@esmi)

    Forum Moderator

    This should be possible to achieve using the main Loop with no need for any extra queries. All you need to do is add a incremental counter to the Loop and then add your CSS and/or markup using the counter as a conditional.

    Although i am good with css and customizing wordpress templates file as i know which section is called when bt not good with php or loop.any pointing in right direction?

    esmi

    (@esmi)

    Forum Moderator

    That’s why I was asking for a complete copy of the relevant template file in the pastebin. And if the most recent posts always going to use the standard port format or could it use any one of a number of supported posts formats?

    here is the code, i explain in comments too.
    the format changes of different pages but on homepage the style remain same i.e latest one get big full space and other ones get clickable thumbnails

    [This is not a live chat box. Wait for your answer]

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘sticky posts not displaying’ is closed to new replies.