How to remove only pages from Admin Bar?

The menu bar is all controlled by an object instantiated as $wp_admin_bar. I think this is what you want: function remove_page_menu_wpse_104826() { global $wp_admin_bar; // var_dump($wp_admin_bar); // debug; uncomment and look at the bottom of the page for the big mess $wp_admin_bar->remove_menu(‘new-page’); } add_action(‘wp_before_admin_bar_render’, ‘remove_page_menu_wpse_104826’, 1);

loading a javascript on a WP PAGE

You’ll find a file called functions.php in your theme folder. Open it and add the following snippet: function wpse_109027_enqueue_js() { wp_enqueue_script( ‘custom-script’, get_stylesheet_directory_uri() . “https://wordpress.stackexchange.com/js/script.js”, array( ‘jquery’ ) ); } add_action( ‘wp_enqueue_scripts’, ‘wpse_109027_enqueue_js’ ); wp_enqueue_script is used to add javascript files. The array(‘jquery’) part means that WordPress should load jQuery before loading your javascript file. … Read more

Remove comment section from new page

If you want to be rid of comments on your site, one option is to remove the code from your theme files. You would need to search single.php, home.php, page.php, etc. within wp-content/themes/*your-active-theme* and find: <? php comments_template(); ?> Remove that and the comments section should disappear. NOTE: this change will be undone if you … Read more

Change a Page’s Header Image

The body tag has quite a few classes eg “home page page-id-### page-template page-template-template-name” you could make use of to customize the header with css. Just specify a different target: .home .header-wrapper { background-image: url(img/some-other-image.png); }

WordPress backend:How to hide some specific pages under Pages–>All Pages

I used the following code snippet into one of my project. Use the code snippet into the functions.php within the main PHP tag: // HIDE SOME PAGES FROM THE EYE OF EDITOR function wpse20131126_exclude_pages_from_admin($query) { global $pagenow, $post_type; if (is_admin() && current_user_can(‘editor’) && $pagenow==’edit.php’ && $post_type ==’page’) { $query->query_vars[‘post__not_in’] = array( ’77’, // the security … Read more

This code won’t find authors page?

Building URLs to WP resources in this fashion is fragile and shouldn’t be done. You should use appropriate API function to generate the links, in this case probably get_author_posts_url().

Post Fetching Ignoring Sort_Column?

I’m not sure why you use the sort_column parameter, it’s not supported by the WP_Query() class. According to the Codex, the correct way to sort, is to use the order and orderby parameters. Please try this: $args = array( ‘post_type’ => ‘page’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, // DESC is the default order ‘post_status’ … Read more