frha
Forum Replies Created
-
Forum: Hacks
In reply to: Showing private pages in default page-menuThx.
I found that creating a basic plugin was actually easier than creating a child-theme 🙂
I only had to create this one php-file, and put it in my plugins-directory. Then i was able to enable it for my network.So for now, since I believe this is the appropiate way to ‘hide/show’ private pages, I’ll leave it enabled for all sites in the network.
I’ll have to dig deeper in order to find the right method for enabling private pages to be selectable when creating custom menues 🙂
save this as ‘view_private.php’ in the plugin-directory…
<?php /** * @package View_Private * @version 1.0 */ /* Plugin Name: View Private Description: This plugin allows for viewing of private pages in the default page-menu Version: 1.0 */ function my_page_menu_args( $args ) { if(current_user_can('read_private_pages')) { $args['post_status'] = 'publish,private'; } return $args; } add_filter( 'wp_page_menu_args', 'my_page_menu_args' ); ?>Forum: Hacks
In reply to: Showing private pages in default page-menuI agree that filter could be the way to go for more of the options, but then there should be a way to apply filters without having to create child-themes. I don’t want to have to redo this work for every theme I want to make available in my network.
In this explicit case, I also had to inlcude the default-value for the method, since the filter is applied before the default-value is applied…
I haven’t tried to create a plugin yet – could this filter have been applied just as easy by installing it in a plugin ?