Skip to content

Instantly share code, notes, and snippets.

@jandrodev
Created July 30, 2015 09:12
Show Gist options
  • Save jandrodev/bc135f5f11b2f99537b2 to your computer and use it in GitHub Desktop.
Save jandrodev/bc135f5f11b2f99537b2 to your computer and use it in GitHub Desktop.
Basic Wordpress Post Type Creation
function create_post_type_eventos() {
register_post_type( 'eventos',
array(
'labels' => array(
'name' => __( 'Eventos' ),
'singular_name' => __( 'Eventos' ),
'all_items' => __('Todos los eventos'),
),
'public' => true,
'has_archive' => true,
'rewrite' => true,
'menu_icon' => 'dashicons-calendar',
'menu_position' => 6,
'supports' => array( 'title', 'excerpt', 'editor', 'thumbnail' )
)
);
$set = get_option('post_type_rules_flased_eventos');
if ($set !== true){
flush_rewrite_rules(false);
update_option('post_type_rules_flased_eventos',true);
}
}
add_action( 'init', 'create_post_type_eventos' );
@jandrodev
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment