Beispiel #1
0
function does_page_exists($post_name)
{
    global $wpdb;
    if ($wpdb->get_row("SELECT post_name FROM wp_posts WHERE post_name = '" . $post_name . "'", 'ARRAY_A')) {
        return true;
    } else {
        return false;
    }
}
// change the Sample page to the home page
if (isset($_GET['activated']) && is_admin()) {
    $home_page_title = 'Home';
    $home_page_content = '';
    $home_page_check = get_page_by_title($home_page_title);
    $home_page = array('post_type' => 'page', 'post_title' => $home_page_title, 'post_content' => $home_page_content, 'post_status' => 'publish', 'post_author' => 1, 'ID' => 2, 'post_slug' => 'home');
    if (!isset($home_page_check->ID) && !the_slug_exists('home')) {
        $home_page_id = wp_insert_post($home_page);
    }
}
/**
 * Hide editor on specific pages.
 *
 */
add_action('admin_init', 'maker_hide_editor');
function maker_hide_editor()
{
    // Get the Post ID.
    $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
    if (!isset($post_id)) {
        return;
    }
// ACTION | ACTOR | VENUE | SHOW
$alias = $_GET['alias'];
$title = $_GET['name'];
$code = $_GET['code'];
function the_slug_exists($post_name)
{
    global $wpdb;
    if ($wpdb->get_row("SELECT post_name FROM wp_posts WHERE post_name = '" . $post_name . "'", 'ARRAY_A')) {
        return true;
    } else {
        return false;
    }
}
if ($code == 'zYjs0987djJJshy') {
    require_once 'wp-load.php';
    if (!the_slug_exists($alias)) {
        $tpl = '';
        switch ($type) {
            case 'ACTION':
                $tpl = 'action.php';
                break;
            case 'ACTOR':
                $tpl = 'actor.php';
                break;
            case 'VENUE':
                $tpl = 'venue.php';
                break;
            case 'SHOW':
                $tpl = 'show.php';
                break;
        }