How to Sorting Posts in Alphabetical Order in custom wordpress page?. I tried query_posts('posts_per_page=10&orderby=title&order=asc'); but it is not working.
query_posts('posts_per_page=10&orderby=title&order=asc'); is the true way to sorting posts in alphabetical order. I tested it and it worked. Can you write here more part of the code?
Thank you. Here is more code. <?php query_posts('posts_per_page=10&orderby=title&order=asc'); if ( have_posts() ) : while ( have_posts() ) : the_post(); { ?> <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php content(50, __('Find out More...')); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> <?php } endwhile; else: endif; //Reset Query wp_reset_query(); ?>
the tags take its value from global variables, in our present case, wpdb . the query statement does the query properly, but still wpdb is unaffected ... assign the result of the query to the global object $wpdb and it will work ... thanks
Can you try this code <?php query_posts('posts_per_page=10&orderby=title&order=asc'); if ( have_posts() ) : while ( have_posts() ) : the_post(); { ?> <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php the_content(50, __('Find out More...')); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> <?php } endwhile; else: endif; //Reset Query wp_reset_query(); ?> PHP: I think it doesn't work because you use function content and I don't know what that function does in your theme. I have changed the function content to the function the_content in my code and I think it has to work.
Still it is not work. I have used the following code into functions.php // Content Limit function content($num, $more_link_text = 'Find out More...') { $theContent = get_the_content($more_link_text); $output = preg_replace('/<img[^>]+./','', $theContent); $limit = $num+1; $content = explode(' ', $output, $limit); array_pop($content); $content = implode(" ",$content); $content = strip_tags($content, '<p><a><address><a><abbr><acronym><b><big><blockquote><br><caption><cite><class><code><col><del><dd><div><dl><dt><em><font><h1><h2><h3><h4><h5><h6><hr><i><img><ins><kbd><li><ol><p><pre><q><s><span><strike><strong><sub><sup><table><tbody><td><tfoot><tr><tt><ul><var>'); echo close_tags($content); echo "<p><a href='"; the_permalink(); echo "'>".$more_link_text."</a></p>"; } PHP: So iam using <?php content(50, __('Find out More...')); ?>( PHP: