Change the order of posts in an archive page

WordPress displays posts according to publish date, newer comes first. It happens in all archive pages, even in home page. Did you ever need of changing order of posts in archive page? Or you thought? Well, there is an easy code snippet to shows posts in reverse order. You can add this codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. [php] function change_order($orderby, $query) { global $wpdb; if(is_archive()) $orderby = “{$wpdb->prefix}posts.post_date ASC”; return $orderby; } add_filter(‘posts_orderby’,’change_order’); [/php] Here is_archive() is used to check if the page is […]

Continue Reading

You may also like

WordPress Multisite: How to show popular post acrosee the network (without any plugin)

WordPress Multisite is a very popular platform now a days for owning of a series of blog site. Well, it can be any e-commerce market. You can easily develop a etsy ptsy style market with MarketPress. Also you can charge your store owner for using your platform as well themes and plugins using Pro Sites. It’s fun, huh? Sometimes we need to show popular posts across our site. That can be easily done. But what if you want to grab popular posts across the network in multisite? Well, that’s not also a rocket science. We will see today how to […]

Continue Reading

You may also like

WordPress Multisite: How to define a common upload folder for all blogs or subsites

In WordPress multisite, media uploaded from the subsite users are stored to different subdirectories using blog id into uploads folder. But, if you need to save all media files in one folder rather than uploads folder with lots of child folders, then you are in right place. Use the following code into your theme functions.php file if you think your theme won’t be changed. Otherwise, mu-plugins is the best option. [php] 0) { $upload[‘path’] = ABSPATH . ‘wp-content/images’; switch_to_blog(1); $upload[‘url’] = site_url() . ‘/’ . ‘wp-content/images’; restore_current_blog(); $upload[‘subdir’] = “”; $upload[‘basedir’] = $upload[‘path’]; $upload[‘baseurl’] = $upload[‘url’]; } return $upload; } […]

Continue Reading

You may also like

How to add extra field in the wordpress user profile

Hi Folks! Sometimes we need to add extra fields in wordpress user profile page for some more information like website URL, bio or AIM etc. Well, there is an easy solution from admin dashboard if you use BuddyPress. You can add new profile fields from Users > Profile fields. But what if you don’t use BuddyPress? Well, you are still able to add extra fields with some line of codes. You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. Let’s jump in the code: […]

Continue Reading

You may also like