Viewing 21 posts - 1 through 21 (of 21 total)
  • Author
  • #24819

    My test site is here:


    This page uses blog posts to display content and the menu on the right shows all posts; this is expected behaviour.

    When you click on a category from the list underneath (such as http://dev.www.ntoklo.com/ntoklo/category/authentication/), a number of posts associated with that category are displayed using the archive.php template and the top section only of the sidebar displays the wrong content.

    In the sidebar.php page, I’ve tried various means of forcing the dynamic_sidebar function to display the correct content, but none of them work – e.g.

    dynamic_sidebar(“Sidebar Blog”);

    I want to display the same list of blog posts on the archive page as you can see on the pages such as developer, nToklo Javascript Tag etc.

    Can you please advise?



    Some of your pages are not there anymore. I am having a hard time following what you are trying to do, I am sorry. Can you explain or better yet illustrate what you want to accomplish.




    Thanks for your reply. The pages are still there, but this forum software seems to have included the trailing ) in the second url listed, which breaks that link.



    On the second page (which uses archive.php), I want the dynamic_sidebar menu containing the blog posts to show (i.e. the same menu as you see on the first page – developer), but when I inclue the code

    dynamic_sidebar(“Sidebar Blog”)

    – in my archive page, I get incorrect content.


    Also, if you check our live site:


    – it doesn’t have this problem. The live site is running theme 1.1 and the dev site is running theme version 1.6.

    There are styling and content changes between the live and dev versions but no significant changes to code – and certainly not to the menu functions. Therefore, I think this may be a bug in the theme.



    You can create a new sidebar for archive page only.

    Create a file name sidebar-archive.php then paste this code http://pastebin.com/9kWRHt9C

    Edit functions.php, place this code below to create a new widget area called Archive Sidebar.

    'name' => __( 'Archive Sidebar' ),
    'id' => 'archive-sidebar',
    'before_widget' => '<div id="%1$s" class="widget clearfix %2$s">',
    'after_widget' => '<span class="seperator extralight-border"></span></div>',
    'before_title' => '<h3 class="widgettitle">',
    'after_title' => '</h3>'

    Edit archive.php, find the code


    Replace it with


    Add widgets on Archive Sidebar widget area.




    Hi Ismael

    Thanks for your help. I did try something similar, but, having tried your code, unfortunately I still get the same problem, in that a call to the function:

    dynamic_sidebar(“Sidebar Blog”)

    – still returns the wrong content. I get a list of the following links:



    Contact Us








    – rather than the actual blog posts, which is what I expect:



    nToklo Javascript Tag





    Core Objects

    As I said in a previous post, this behaviour doesn’t happen on our live site, which uses version 1.1 of the theme, and it does happen on our development site, which runs version 1.6.

    Live (1.1):


    Development (1.6):



    Looks like someone else may have noticed a similar problem:

    https://kriesi.at/support/topic/ (Purchase code hidden if logged out)

    Is it related?



    Did you try the instruction I gave you?

    Please use get_sidebar(‘archive’);




    Hi Ismael

    I have tried all of your code, including the call to dynamic_sidebar passing the ‘archive’ argument. I have amended the functions.php file and created the sidebar-archive.php file, then created the widget within the WP editor.

    You can see the problem on the following pages:

    Right (blog posts using standard template):



    Wrong (using archive and sidebar-archive files you supplied):


    The problem is still there; the widget uses the “Recent posts” component but does not display recent posts correctly. A PNG showing the widgets admin page is here:


    – in which you can see that the sidebar blog and archive sidebar are using the same component.



    Please use get_sidebar not dynamic sidebar. We are calling the file sidebar-archive.php not the registered widget area called archive-sidebar.

    Please read the instructions carefully.

    This works properly on my end. It eliminates all of the query to other sidebars and create a unique one for use in the archive page only.




    I am using a call to get_sidebar(“archive”). (With apologies,) I incorrectly mentioned the dynamic_sidebar function in my last post.

    My sidebar-archive.php file is identical to the one in your pastebin linked above, with the exception that I have a call to get_search_form() above the menu now.

    My archive.php looks like this: http://pastebin.com/T8YR4vqb

    – which I think is right, and yet the problem is still there.

    Thanks for your patience.



    Your menu is too big. I am on a laptop 1360×768, and i can only see the top 2 menu items – API & Authentication – on your bottom most menu on the right. What’s worse is that because your menu immediately scrolls down as i scroll down , I never have an opportunity to click all the links below the first two


    Create an array of id’s that you put in the order you want and use the array instead. Here is

    global $post_ids;

    $post_ids = array(56, 4, 66, 34, 56, 6);

    $args = array(

    'post__in' => $post_ids // should be an array

    'numberposts' => 6


    add_filter('posts_orderby', 'you_best_be_keepin_order'); // add the filter function to order posts in our given order

    $posts = get_posts($args);

    remove_filter('posts_orderby', 'you_best_be_keepin_order'); // remove the filter as we get our posts

    // filter function
    function you_best_be_keepin_order() {

    global $post_ids, $wpdb;

    $post_ids = implode(',', $post_ids); // we made the post ids a string where post ids are separated by comma

    return "FIND_IN_SET(".$wpdb->posts.".ID, '".$post_ids."') ASC"; // FIND_IN_SET is used to get posts in proper order




    Hi Nick

    Thanks for your reply. We know about the scrolling bug and will fix it at a suitable point.

    As for your suggestion, won’t that create a static menu that only includes certain posts? If so, that’s not suitable, as we may change the developer pages in time.



    How about changing the order here, where it is listed on each page, just put a number from 0 to 10 in the pages you want to show up in that order on the menu. http://www.clipular.com/c?8773013=ejLuixQyAyFAh7D4iLLaeK_y99I&f=.png




    I’ve tried pasting the code you gave me into the sidebar-archive.php and it (obviously) doesn’t output anything on to the page. I changed the IDs in the $post_ids array to the values of the posts I’m trying to get.

    I still couldn’t get anything meaningful out of the code you gave me but, regardless of whether it will work with some changes, I think this is an satisfactory solution to the problem – unless I’ve misunderstood you (and please correct me if I have) – the IDs of the posts are hardcoded into the PHP, which means that any change to the menu requires a change to the template, which almost defeats the point of having a content management system.

    It seems to me that this is a bug in your theme – as I’ve said in previous posts on this thread, the problem did not occur in earlier versions of the theme and occurs in the latest one.

    Please can you fix the theme or – in the meantime – provide me with a solution which fixes the problem in the code, rather than a hardcoded hack?



    A blog post by definition can be ordered by date, by author, by tag, by category, by title, by id or randomly. You want them ordered in a specific way that are outside the parameters of what a blog post is capable of. You can delete your posts, and enter them again this time in the order you want from last to first , and since blog posts are normally ordered by date, that is how they will be displayed. You can create a custom menu and set the order of posts in that menu and display it as a widget. I have no idea what you are trying to achieve as an end result so there is not much I can suggest, but to me it seems you are trying to use posts as though they were pages.




    Um, you don’t seem to have a proper understanding of my what I’m asking.

    The problem I’ve found is that, when you include the “Sidebar Blog” on the archive.php template USING VERSION 1.6 of your theme, it doesn’t display the same content as it would USING VERSION 1.1 of your theme.

    Can we please stick to why this is happening, and disregard the order of blog posts etc?




    Please update both to 1.71 which is the current version.

    If you need to document differences between two old versions of the theme you can use http://www.winmerge.org to get a line by line differences when comparing any two folders. Compare 1.1 folder to 1.6 folder and you will see every single difference between them. Then its a matter of trial and error of changing one block of code in 1.6 at a time (degrading it to 1.1) until you hit the line of code that changes the order of the menu items.

    Your request in my opinion is outside the scope of the support team , however there are many freelance developers available to help you find the answer (if you do not wish to update both to 1.71 thereby resolving your issue).




    I’m asking you to fix what looks very much like a bug in your theme. How is that ‘outside the scope of the support team’?



    I spend 1/2 hour and finally see what you are talking about. Sorry about that. I am looking into this now.

    Recent Posts Widget is a WordPress Core Plugin that is automatically added so there is not one line of code about it in the theme.. My suggestion is to reinstall WordPress itself since there is no way for Recent Posts Widget to display pages instead of posts unless your core WordPress install has problems or you’ve edited core wordpress files.

    I tried to replicate your error, and thought I did but no, since one of your widgets shows only blog posts while the second widget shows only pages. For me categories show the same Recent Posts as any other post or page on the website.

    Can you update to WordPress Core 3.52 or you customized it?




    Hi Nick, thanks for persevering…

    I’ll upgrade to WordPress 3.5.2 and version 1.7 of the theme as you suggest.

Viewing 21 posts - 1 through 21 (of 21 total)

The topic ‘Problem with sidebar on archive page’ is closed to new replies.