mar2195
asked on
wordpress archive sort alphabetically
How can I alphabetically sort the posts by title before displaying each post?
Here's the code that I'm using to display the posts in an archive page.
FYI: I am handling the query in this manner because I need to grab the 'raw' contents of the post (including the HTML tags) - not the usual "display a WP post." However, if anyone has an improved manner for 'grabbing' the post content, that's fine too. Basically, any help is appreciated.
Here's the code that I'm using to display the posts in an archive page.
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
$queried_post = get_post($post_id);
$title = $queried_post->post_title;
echo '<p>'.$queried_post->post_content.'</p>';
endwhile;
endif;
?>
FYI: I am handling the query in this manner because I need to grab the 'raw' contents of the post (including the HTML tags) - not the usual "display a WP post." However, if anyone has an improved manner for 'grabbing' the post content, that's fine too. Basically, any help is appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER