Support » Fixing WordPress » Trying to figure out why this code does not work

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator keesiemeijer



    I just tested your code on Twenty Twelve (in a child theme) and it works for me. Are you sure the child theme is activated? Do you see a sticky post at the bottom of the first page?

    I am showing a sticky post on the top, and eight regular posts underneath it, so it is nine posts total on the main page. Settings -> Reading -> Blog pages show at most is set to 10.

    I am basing it on a child theme, and I use the following files:


    The contents of the files (directly from the server) are here:

    # # #

    I will be probably working on modifying 20 different wordpress thems, and all of them need to display a single sticky post on the bottom of the main page. Unfortunately there is no plugin that achieves this task.

    Moderator keesiemeijer



    What is it exactly that is not working? Do you see a sticky post at the bottom of the first page? Is the pagination not working? How do you show a sticky on top of the first page?

    The sticky is on the top instead of on the bottom, and there is 8 + 1 posts on the page, instead of 10.

    Moderator keesiemeijer



    That’s strange, I tested again with the code from your server in my child theme and it works (sticky at the bottom of the home page).

    Can you try:

    – flushing any caching plugins you might be running, as well as server and/or browser caches.

    – deactivating all plugins to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    I created a brand new WordPress installation (the newest version, 3.5.1), and Twenty Twelve 1.1 was included by default. I did not install anything else. This means I dont have any plugin, WordPress cache, or anything like that.

    I uploaded twenty_twelve_sticky_new over the ftp (exactly the same files that I included in pastebin in the previous post), and I display sticky on the top (as the first post), and 8 posts underneath it.

    The website is located at (no adult content)

    Moderator keesiemeijer



    When I look at the source code the “This is Sticky” post doesn’t have a class “sticky”. Are you sure you made it a sticky post?

    // your "This is Sticky" post":
    <article id="post-45" class="post-45 post type-post status-publish format-standard hentry category-uncategorized">
    // sticky post on my test site:
    <article id="post-68" class="post-68 post type-post status-publish format-standard sticky hentry category-uncategorized">

    Thank you. That’s it. Everything is working fine.

    I spent some time reading on how wordpress code works (The Loop, template files, template tags), and moved on to another theme, called Blaskan (

    I modified the index.php and loop.php of the theme, to incorporate the “display sticky on the bottom” code, but I get a sticky on the top and on the bottom of the page at the same time (eleven posts total).

    I’ve been trying to figure out what’s going on for a while, but I am not able to find a solution.

    The code for the current index.php, and loop.php is here:

    (It is different from the original structure, as I inserted the main loop into index.php <it is originally in loop.php>, and modified the loop.php to include only the formatting of the posts)

    If it would be needed, I included the orginal Blaskan code for these two files here:

    Thank you in advance for any info.

    I changed the published date to something in the past, and it is still displaying on the very top (and on the bottom), so it does not have anything to do with the fact that it is the most recent post etc. It is on the top because it is set to sticky (I want it on the bottom only).

    I was able to get it to work. I forgot about making changes to functions.php file.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Trying to figure out why this code does not work’ is closed to new replies.