Skip to content

Instantly share code, notes, and snippets.

@alexavalossv
Last active January 10, 2020 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexavalossv/4b72ebd234c877d58fb8c25410202bcd to your computer and use it in GitHub Desktop.
Save alexavalossv/4b72ebd234c877d58fb8c25410202bcd to your computer and use it in GitHub Desktop.
Ejemplo de como podés crear un CPT con lo mínimo necesario para funcionar en tu web con WordPress.
<?php
/*
Plugin Name: Tu CPT's
Plugin URI: https://tuweb.com
Description: Plugin para crear CPT's
Version: 1.0.0
Author: Tu Nombre
Author URI: https://tuweb.com
License: GPL 2+
License URI: https://tuweb.com
*/
add_action( 'init', 'ejemplo_cpt' );
function ejemplo_cpt() {
register_post_type( 'ejemplo', array(
'label' => 'Ejemplo',
'public' => true,
'menu_icon' => 'dashicons-portfolio',
'has_archive' => true,
));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment