- Ausschalten von Autosave und Revision Funktion macht man mit folgenden Code in der Config.php
define (‘WP_POST_REVISIONS’, 0);
define(‘AUTOSAVE_INTERVAL’, 600);
- Um ein Custom Post Type anzulegen üge in die fuction.php folgenden Code ein:
// Anfang Eigener Custom Post Type Beispiel Center
// Filter um die Post auf der Start seite anzuzeigen. Ist die vatiante außerhalb vom loop
add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) {
if ( is_home() && false == $query->query_vars['suppress_filters'] )
$query->set( 'post_type', array( 'post', 'center' ) );
return $query;
}
// Ende Filiter
add_action('init', 'center');
function center()
{
$labels = array(
'name' => _x('Center', 'post type general name'),
'singular_name' => _x('Center', 'post type singular name'),
'add_new' => _x('Add New', 'center'),
'add_new_item' => __('Add New Center'),
'edit_item' => __('Edit Center'),
'new_item' => __('New Center'),
'view_item' => __('View Center'),
'search_items' => __('Search Center'),
'not_found' => __('No Center found'),
'not_found_in_trash' => __('No Center found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array('slug' => 'center'),
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt','custom-fields', 'comments')
);
register_post_type('center',$args);
}
// Ende Custom Post Type: Center
Keine Kommentare:
Kommentar veröffentlichen