Created
December 29, 2011 22:18
-
-
Save collegeman/1536451 to your computer and use it in GitHub Desktop.
Filtering the list of Targets for SharePress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter('sharepress_ok_page_names', '__my_sharepress_ok_page_names'); | |
| function __my_sharepress_ok_page_names($pages) { | |
| $current_site = get_current_site(); | |
| if ($current_site->blog_id == 1) { | |
| return array('OK Page Title for Blog #1'); | |
| } else if ($current_site->blog_id == 2) { | |
| return array('OK Page Title for Blog #2'); | |
| } else { | |
| return $pages; // your default might be none, by way of array() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter('sharepress_ok_page_names', '__my_sharepress_ok_page_names'); | |
| function __my_sharepress_ok_page_names($pages) { | |
| // Here, if the current user is an administrator, we allow | |
| // her to choose from any of the available pages | |
| if (current_user_can('administrator')) { | |
| return $pages; | |
| // Otherwise, we define a specific list | |
| } else { | |
| return array("OK Page Title 1", "OK Page Title 2"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter('sharepress_ok_page_names', '__my_sharepress_ok_page_names'); | |
| function __my_sharepress_ok_page_names($pages) { | |
| // the list should include as many or as few pages as | |
| // should be available as targets | |
| return array("OK Page Title 1", "OK Page Title 2"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment