Пример #1
0
function hocwp_maintenance_mode_exclude_condition()
{
    $condition = hocwp_is_admin();
    return apply_filters('hocwp_maintenance_mode_exclude_condition', $condition);
}
Пример #2
0
function hocwp_classifieds_admin_pre_get_posts($query)
{
    global $pagenow, $post_type;
    $user = wp_get_current_user();
    if ('edit.php' == $pagenow && !hocwp_is_admin()) {
        $query->set('author', $user->ID);
    }
    return $query;
}
Пример #3
0
function hocwp_setup_warning_php_recommend_version()
{
    if (function_exists('hocwp_theme_license_valid') && !hocwp_theme_license_valid()) {
        unset($_GET['activated']);
        return;
    }
    global $wp_version;
    $transient_name = 'hocwp_warning_php_recommend_version_%s';
    $transient_name = hocwp_build_transient_name($transient_name, '');
    if (false === get_transient($transient_name)) {
        if (hocwp_is_admin()) {
            if (version_compare(PHP_VERSION, HOCWP_RECOMMEND_PHP_VERSION, '<')) {
                hocwp_setup_warning_php_minimum_version();
            }
        }
    }
}
Пример #4
0
function hocwp_setup_theme_prevent_delete_sidebar($post_id)
{
    $post = get_post($post_id);
    if ('hocwp_sidebar' == $post->post_type) {
        $prevent = false;
        if (!hocwp_is_admin()) {
            $prevent = true;
        }
        $default = (bool) get_post_meta($post_id, 'sidebar_default');
        if ($default) {
            $prevent = true;
        }
        if ($prevent) {
            wp_die(__('You don\'t have permission to delete this post!', 'hocwp-theme'));
        }
    }
}