Support » Plugin: Post Types Order » Post Type Order Stops Random Header Image Showing

  • Resolved keith0__0


    I’m using post type orders 1.5.7 with WordPress 3.5 and the included theme Twenty Twelve.

    In the theme admin under Appearance > Headers – theirs a feature where you can upload header images, then select “Random: Show a different image on each page” from the options. When this is selected and the plugin is active, no image shows in the front end. De-activate the plugin and the random images show.

    As a note this only happens when the plugin is set to Auto Sort.

    This is a fresh install, with no posts and no other plugins.

    Any help would be greatly appreciated…

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author nsp-code


    This is an expected behavior, as using the Autosort ON will auto update all queries to use the menu_order, so any random will be overwrite.
    I suggest to turn OFF the Autosort feature, then go to theme and edit the exact custom query where you need the custom order, by include the ‘orderby’ => ‘menu_order’ parameter.

    Yep that did it.

    I included ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’ to my query_posts array, unticked auto sort and now its all working.

    Many Thanks for your quick reply.

    HI there,
    i do have the same problem but my knowledge about coding is not so,…

    Which file of the theme content the code where i should insert the ‘orderby’ => ‘menu_order’

    How should be the line afterwards? Can you write me a sample what i can copy&paste?

    thanks in advanced!

    … more precisely, where can i find the “theme queries”?
    greets T.

    Soveld my problem with the dailypost template header! Thanks!

    Plugin Author tdgu


    Tronic you should check with Wp_Query which should give you an idea on what to check for.

    hi, honestly, this is little to complicated for me, i am not so good in coding, i am more or less the “copy&paste-coder”. my strengh is in other fields. isn´t there a simple solution or explaination? the random header is not a must-have, but a nice feature which pep up my site.

    thanks in advance.

    Hi Tronic,

    I’m afraid their isn’t a simple answer to this. Every theme will call the queries in different places throughout the theme files. To add to that, a query can be called using two methods (that i know of). In my theme (portfolium) the author used query_posts, whereas i know the default wordpress template uses wp_query.

    The steps i used to update my theme (this will require a basic understanding of how themes work):

    1. Make a copy of the theme (just in case something goes horribly wrong).
    2. Use Dreamweavers search and replace function (cmd+F), and search the copied theme folder for all instances of query_posts and / or wp_query.
    3. Select every instance, and modify the array, adding ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’
    4. Test the changed theme files. I.e if you changed an occurrence in the single.php file test a single post.

    Hope thats some help…

    Plugin Author nsp-code


    Yep, keith0__0 is right, you should just search for your theme for new Wp_Query($argv) and/or get_posts() then modify/add ‘orderby’ => ‘menu_order’. Turn OFF the autosort (plugin settings area) and it will use the custom order just in the place you did the update.

    hi there,
    THIS tutorial seems to be good for me, i think i can do it now. just will wait for a calm evening to give it a try! thanks anyway, i will post my progress!

    I wish it was simple and it probably is. But i think i just don’t get it… I’m also more a copy/paste ‘builder’. :S
    I tried adding the ‘orderby’ => ‘menu_order’ in the sidebar.php and it looked something like this:

      Template Name: Portfolio
    <?php get_header(); ?>
        <div id="single_container">
          $args = array(
                       'category_name' => 'portfolio',
                       'post_type' => 'post',
                       'posts_per_page' => 21,
    		   'orderby' => 'menu_order'
                       'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),
          $x = 0;
          while (have_posts()) : the_post(); ?>                
            <?php if($x == 2) { ?>
            <div class="port_box port_box_last">
            <?php } else { ?>
            <div class="port_box">
            <?php } ?>
              <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('featured-port-listing'); ?></a>
              <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
            <?php if($x == 2) { echo '<div class="clear"></div><div class="port_box_divider"></div>'; $x = -1; } ?>
          <?php $x++; ?>
          <?php endwhile; ?>
          <div class="clear"></div>
          <div class="navigation">
            <div class="left"><?php previous_posts_link('&laquo; Previous') ?></div>
            <div class="right"><?php next_posts_link('Next &raquo;') ?></div>
            <div class="clear"></div>
          <?php wp_reset_query(); ?>                  
          <div class="clear"></div>
    <?php get_footer(); ?>

    Is this the right place to add it? Or did i have to put it somewhere else/instead of something else? And, next question where else? In every php file? I’m a dreamweaver dummy so adding it manually in the WP editor is somewhat easier for me.

    Hi resw,

    You missed a comma off the end of the statement 🙂

    $args = array(
                       'category_name' => 'portfolio',
                       'post_type' => 'post',
                       'posts_per_page' => 21,
    		   'orderby' => 'menu_order', // <-- add the comma on the end
                       'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),

    You don’t have to replace any code, just add ‘orderby’ => ‘menu_order’, to the array like you did in your example.

    The query could be in a number of the theme php files. The reason i suggested Dreamweaver is because it has a search tool, you don’t need to use it though. Any search tool will do (i think even windows file explorer can search source code in a specified folder?)

    Good luck…

    Pfff. One thing i did find out, i’m not as stupid as i thought. I found (with Dreamweaver!) all the query, altered them by adding ‘orderby’ => ‘menu_order’, <—–with the comma!.
    Saved it all, dropped it in with filezilla and he presto, this is what my screen said…

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘)’ in /public/sites/ on line 363

    Still not working…
    should i give up? ~_~

    I fixed that last one. Got the site running again but now the sidebar images are still fixed but flipped around from back to front. ? LOL. I think i will need some serious lessons first.

    Hi, i found time to play around with my random header problem. the only “wp_query” i found was in the loop.php of my child theme (twenty ten). its for the functin of “next/last posting”. i dont think i am right there.
    any more advice? you are my last hope : )

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Post Type Order Stops Random Header Image Showing’ is closed to new replies.