validate_page() )
{
//Otherwise stop
return;
}
//Declare settings using filter
$this->settings = apply_filters('acps/get_settings', 'all');
//Add custom styles
wp_enqueue_style(array(
'acps-admin-styles'
));
}
//Validate post page
function validate_page()
{
//Wordpress global variable 'pagenow'
global $pagenow;
//Check if page is post new page
if( in_array( $pagenow, array('edit.php') ) )
{
//Check post type is acps
if( isset($_GET['post_type']) && $_GET['post_type'] == 'acps' )
{
//Make sure we aren't on a settings page
if( isset($_GET['page']) && $_GET['page'] == 'acps_settings_page.php' )
{
//If we are, returns false
$return = false;
}
else
{
//Page is correct, return true
$return = true;
}
}
else
{
//Page incorrect, returns false
$return = false;
}
//Return validation value
return $return;
}
}
//Check if user has any post types
function has_post_types()
{
//Get all [non-standard] post types
$not_default = array(
'public' => true,
'_builtin' => false
);
//Set up post types array
$posttypes = get_post_types($not_default);
//Check if the array is empty
if( empty($posttypes) )
{
//Return false if empty
return false;
}
else
{
//Return true if not empty
return true;
}
}
function admin_footer()
{
//Only put this one the search forms page using validate page
if( $this->validate_page() )
{
?>
validate_page() && ! $this->has_post_types() )
{
?>