Skip to content

Instantly share code, notes, and snippets.

@collegeman
Created December 29, 2011 22:18
Show Gist options
  • Select an option

  • Save collegeman/1536451 to your computer and use it in GitHub Desktop.

Select an option

Save collegeman/1536451 to your computer and use it in GitHub Desktop.
Filtering the list of Targets for SharePress
<?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()
}
}
<?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");
}
}
<?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