How do you add a WordPress admin page without adding it to the menu?
Best solution here http://wordpress.org/support/topic/add-backend-page-without-menu-item use add_submenu_page with parent slug = null
Best solution here http://wordpress.org/support/topic/add-backend-page-without-menu-item use add_submenu_page with parent slug = null
Or more universal way: function add_async_forscript($url) { if (strpos($url, ‘#asyncload’)===false) return $url; else if (is_admin()) return str_replace(‘#asyncload’, ”, $url); else return str_replace(‘#asyncload’, ”, $url).”‘ async=”async”; } add_filter(“clean_url’, ‘add_async_forscript’, 11, 1); so you can add async to any script without code changes, just add #asyncload to script url as: wp_enqueue_script(‘dcsnt’, ‘/js/jquery.social.media.tabs.1.7.1.min.js#asyncload’ )
There is no option for this, but you can extend the ‘walker’ object that WordPress uses to create the menu HTML. Only one method needs to be overridden: class My_Walker_Nav_Menu extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat(“\t”, $depth); $output .= “\n$indent<ul class=\”my-sub-menu\”>\n”; } } Then you just pass an instance of your … Read more
I would suggest to use a WordPress internal constant to solve this case: $my_plugin = WP_PLUGIN_DIR . ‘/my-plugin’; if ( is_dir( $my_plugin ) ) { // plugin directory found! } Alternative The other valid alternative is to compute the path from the URL which is more complex/confusing. I would not use this code: $plugins_url = … Read more
<?php $taxonomy = ‘product_cat’; $orderby = ‘name’; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // 1 for yes, 0 for no $hierarchical = 1; // 1 for yes, 0 for no $title=””; $empty = 0; $args = array( ‘taxonomy’ => $taxonomy, ‘orderby’ => $orderby, ‘show_count’ => $show_count, ‘pad_counts’ => … Read more
You only need to change the access permissions for your WordPress Directory: chown -R www-data:www-data your-wordpress-directory
Nice question! But, as your code starts with a bad practice – require_once(‘wp-load.php’); -, I decided to pick one of my working snippets and adapt it. Observations: Differently from your code, no external quotes.txt is being grabbed, here a Post Type is used as source (post), in the method get_random_post There can only be one … Read more
There is a meta capability create_posts that is documented here and is used by WordPress to check before inserting the various ‘Add New’ buttons and links. In your custom post type declaration, add capabilities (not to be confused with cap) and then set it to false as below. register_post_type( ‘custom_post_type_name’, array( ‘capability_type’ => ‘post’, ‘capabilities’ … Read more
Log in to the admin panel (localhost/sitedirectory/wp-admin) and go to Settings->Permalinks and click Save Changes. Permalinks often need to be rebuilt after mirroring a site and updating the site url. You don’t need to change any settings, just hit save and it will rebuild the permalinks with the selected options. Also make sure the Apache … Read more
Since WP v3.1 it’s ridiculously easy to search for a user by his/her meta key. Use the function get_users($args) (WP Documentation) The function takes an array of parameters, in your case you need get_users(array( ‘meta_key’ => ‘parent_id’, ‘meta_value’ => ’42’ ))