how do you move posts within a category?
-
at the top of this events category there is a post ‘evolutionary dance’. i’d like for it to be re-oreder to appear at the bottom of the category page. https://www.transformingscotland.com/?cat=11
is this possible?
-
can anyone help with this one please?
i noticed a couple of plugins related to the topic, tried them though they were out of date as far as WP version compatibility was concerned.
First, create/edit your category.php in your active theme folder (or create one specifically for the category you linked to above).
Second, manipulate the order or orderby parameters in the query just before you start the loop.
thanks a lot david, i understand your instruction but the implementation is a bit beyond my reckoning
i don’t have a category.php… what content should a newly created one have? would it be the content of archives.php?
https://codex.www.ads-software.com/Stepping_Into_Templates
To create a category.php you can copy’n paste the index.php to start. If there was no category.php, then WordPress used the index.php to display the category.
Edit: If your theme has an archive.php(not archives.php), WordPress will use that if you have no category.php. You can copy’n paste archive.php as your new category.php.
Note: archives.php is a page template if it has something like the following at the top `<?php
/*
Template Name: Archives
*/
?>`ok i used the archive.php content to create a new category.php
there is no order parameters in there though (nor in index.php), would i need to create them somehow?
Add
query_posts( 'order=ASC' );
just before the loop in your new category.php
https://codex.www.ads-software.com/Template_Tags/query_posts#Usage
thanks David
I did this but afterwards found when i clicked into the category there was no change in order and all the excerpts were gone. Each posts was listed full in its entirety one after the other
the new category.php:
<?php get_header(); ?> <div class="span-24" id="contentwrap"> <div class="span-16"> <div id="content"> <?php if(is_home()) { include (TEMPLATEPATH . '/featured.php'); } ?> query_posts( 'order=ASC' ); <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <!-- <div class="postdate"><img src="<?php bloginfo('template_url'); ?>/images/date.png" /> <?php the_time('F jS, Y') ?> <img src="<?php bloginfo('template_url'); ?>/images/user.png" /> <?php the_author() ?> <?php if (current_user_can('edit_post', $post->ID)) { ?> <img src="<?php bloginfo('template_url'); ?>/images/edit.png" /> <?php edit_post_link('Edit', '', ''); } ?></div> --> <div class="entry"> <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(200,160), array("class" => "alignleft post_thumbnail")); } ?> <?php the_content('<strong>Read more »</strong>'); ?> </div> </div><!--/post-<?php the_ID(); ?>--> <?php endwhile; ?> <div class="navigation"> <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> <?php } ?> </div> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php get_search_form(); ?> <?php endif; ?> </div> </div> <?php get_sidebars(); ?> </div> <?php get_footer(); ?>
First, you need to paste php code within php tags:
<?php query_posts( 'order=ASC' ); ?>
Second, what you have in the category.php above is not the same as what is output from the original link in your first post. So try again.
You’ll need to figure out which template page is being used when you hit a category link in the first place. I’m taking a blind guess, is all. And clearly you’ve picked the wrong template page to turn into a category.php. I don’t have your template( you can post the download link hint hint).
“What template file will WordPress use when a certain type of page is displayed?”
I just had a look at the template files for Amirra and the archive.php doesn’t look like the code you’ve pasted above either.
If the template has an archive.php, and no category.php, any category link will use archive.php. If the template has no archive.php, then it will use the index.php.
Look at your archive.php again …
and near the top …
this
<?php if (have_posts()) : ?>
will become this
<?php query_posts( 'order=ASC' ); ?> <?php if (have_posts()) : ?>
after you’ve pasted the entire contents of archive.php into your new category.php (or category-11.php if you are changing parameters for only category “11” )
so sorry about the above pasting mistake
okay i’ve got it now using archive.php as category-11.php and have added <?php query_posts( ‘order=ASC’ ); ?>
what’s occurring is that when i click the event category the posts on the homepage are showing in ascending order and the sidebar is showing beneath. the events category posts are not there
how can i get it to recognise the correct category posts?
https://www.transformingscotland.com/wp-content/themes/Amirra/Amirra/category-11.php
https://www.transformingscotland.com/wp-content/themes/Amirra/Amirra/archive.php
Whoops, try
<?php global $query_string; query_posts($query_string . "&order=ASC"); ?>
instead of
<?php query_posts( 'order=ASC' ); ?>
PS. Your links to your installed theme’s php files are not required and can’t display the code in them anyway.
PPS. Odd that your theme is nested in two folders: themes/Amirra/Amirra/index.php
the nested folders is probably due to my sloppy unzipping process when downloading the new theme onto my desktop
it’s worked! thank you .. i really appreciate your time (and patience)
is it possible to re-rder in accordance with post numbering?
the category won’t change much over time if at all so the posts will remain static
is it possible to re-rder in accordance with post numbering?
<?php global $query_string; query_posts($query_string . "&orderby=ID&order=ASC"); ?>
thanks David
can i change post ID’s somehow so that i have more control over the particular order?
i don’t really want to go through the pain of reposting them all in changed
i went through the pain.. it was okay
thanks a lot for your good help David, much appreciated
- The topic ‘how do you move posts within a category?’ is closed to new replies.