WordPress.org

Ready to get started?Download WordPress

Forums

Post Types Order
[resolved] Post Type Order Stops Random Header Image Showing (16 posts)

  1. keith0__0
    Member
    Posted 1 year ago #

    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...

    http://wordpress.org/extend/plugins/post-types-order/

  2. nsp-code
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. keith0__0
    Member
    Posted 1 year ago #

    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.

  4. tronic
    Member
    Posted 1 year ago #

    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!
    Tronic

  5. tronic
    Member
    Posted 1 year ago #

    ... more precisely, where can i find the "theme queries"?
    greets T.

  6. final
    Member
    Posted 1 year ago #

    Soveld my problem with the dailypost template header! Thanks!

  7. tdgu
    Member
    Posted 1 year ago #

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

  8. tronic
    Member
    Posted 1 year ago #

    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.
    T

  9. keith0__0
    Member
    Posted 1 year ago #

    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...

  10. nsp-code
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  11. tronic
    Member
    Posted 1 year ago #

    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!
    T

  12. resw
    Member
    Posted 1 year ago #

    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:

    <?php
    /*
      Template Name: Portfolio
    */
    ?>
    
    <?php get_header(); ?>
    
        <div id="single_container">
    
          <?php
          $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),
                       );
          query_posts($args);
          $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>
            </div><!--//port_box-->      
    
            <?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>
          </div><!--//nagivation-->
          <?php wp_reset_query(); ?>                  
    
          <div class="clear"></div>
    
        </div><!--//single_container-->
    
    <?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.

  13. keith0__0
    Member
    Posted 1 year ago #

    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),
                       );
          query_posts($args);

    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...

  14. resw
    Member
    Posted 1 year ago #

    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/www.rentadesigner.info/wp-content/themes/architekttheme/functions.php on line 363

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

  15. resw
    Member
    Posted 1 year ago #

    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.

  16. tronic
    Member
    Posted 8 months ago #

    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 : )

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic