query_posts sort in multiple directions

OrderBy The query functions, like get_posts(), query_posts() call a new WP_Query inside – they’re just wrappers. The more important thing is what goes on in the class WP_Query. Specifically inside WP_Query -> get_posts(). When you add an orderby argument, then the following happens: WP checks if it set. If not, then it uses the $wpdb->posts.post_date … Read more

Network setup tab is not shown under Tools

You may want to try putting the line define( ‘WP_ALLOW_MULTISITE’, true ); somewhere near the topic your wp-config.php file. Also make sure you don’t have anything like // or anything like on the same line as it may comment out the define statement. Source: http://codex.wordpress.org/Create_A_Network “Step 2: Allow Multisite “

Adding extra info via GET while registeration in wordpress

I’ve recently written an affiliate plugin where i had to do pretty much the same stuff. Here’s a chopup of the relevant parts: To process the extra info you get from the registration form: add_action(‘user_register’, ‘my_handle_signup’, 10, 2); function my_handle_signup($user_id, $data = null) { $reg_ip = $_REQUEST[‘reg_ip’]; $referrer = $_REQUEST[‘referrer’]; if (isset($reg_ip) && isset($referrer)) { … Read more

wp_head() remove redundant scripts?

There’s no filter that covers the entire output produced during wp_head(). You would have to use a fairly complicated process of output buffering starting before wp_head, then filtering out what you don’t want afterwards, before releasing the buffer. Lets assume that you’re dealing with plugins that have registered their scripts properly> Try adding this to … Read more

Comment filtering (search)

You create your own comments_template, it can be a duplicate function of the default one, the only changes are the database queries anyway. But you need your own function as WP doesn’t help you with filters here. SO, name it my_comments_template(): $filter = mysql_real_escape_string($_POST[‘comment-filter’]); if(!empty($filter)) $filter = “AND (comment_content LIKE ‘%%{$filter}%%’ OR comment_author LIKE ‘%%{$filter}%%’)”; … Read more

How to remove unnecessary elements in the HTML document head

This are default settings fron WordPress. This was set via wp-includes/default_filters.php or the feed inside your theme. Check the theme, functions.php for add_theme_support( ‘automatic-feed-links’ ); and remove it. Add this via plugin or functions.php in your theme for remove the different defaults, hints and small description is on the source. remove_action( ‘wp_head’, ‘feed_links_extra’, 3 ); … Read more

Extra User Profile Field Upload File / Image

PHP CODE /* * Load style & scripts */ function itclanbd_admin_load_scripts( $hook ) { $allowed = [‘profile.php’, ‘user-new.php’, ‘user-edit.php’]; if ( ! in_array( $hook, $allowed ) ) { return; } wp_enqueue_media(); wp_enqueue_style(‘finance2sell’, plugins_url(‘css/style.css’, __FILE__), array(), null); wp_enqueue_script(‘finance2sell’, plugins_url(‘js/scripts.js’, __FILE__), array(), ‘1.3’, true); } add_action( ‘admin_enqueue_scripts’, ‘itclanbd_admin_load_scripts’ ); /** * Create custom fields * @param $user … Read more