Displaying popular posts

You can attach images to each post using “featured images” by first enabling featured images for your theme using add_theme_support(‘post-thumbnails’), and get_the_post_thumbnail() to display images. For example, to list 4 most commented posts with their featured image and title, you can do something like this: $posts = get_posts( array( ‘posts_per_page’ => 4, ‘order_by’ => ‘comment_count’ … Read more

Sort loop with query in the link

You could use rewrite rules but doing it the way you’ve put should be fine. It’s safe so long as you sanitize the query string. Using add_query_arg() you can add a query to the end of your current URL, like this: $link = add_query_arg( ‘orderby’, ‘name’, get_permalink() ); You can then, for example, apply it … Read more

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