How do i Sort my Posts

You can order your posts by several strings that are available in WP.

The normal way is by alphabetizing or via a plugin.
You have the option between order by name or date.

But if you want to order your posts by custom tags eg. “most popular”, “relevance”,…
Then you could custom code that in by following the reference here.

The snippet for ordering by “most popular” for example is:

<?
query_posts('meta_key=post_views_count&orderby=meta_value_num&order=DESC');
?>

Or by “most views”:

<?php $posts_per_page = get_query_var('posts_per_page'); ?>
<?php $paged = intval(get_query_var('paged')); ?>
<?php $paged = ($paged) ? $paged : 1; ?>
<?php $args = array(
   'posts_per_page' => $posts_per_page,
   'paged' => $paged,
   'more' => $more = 0,
   'meta_key' => 'views',
   'orderby' => 'meta_value_num',
   'order' => 'ASC',
); ?>
<?php query_posts($args); ?>

You’ll have to program a series of functions depending on what you want…

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)