Skip to content

Instantly share code, notes, and snippets.

@AndreaBarghigiani
Created January 2, 2020 10:40
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 AndreaBarghigiani/c72fe0e034bbd5a64c86625e44390f7b to your computer and use it in GitHub Desktop.
Save AndreaBarghigiani/c72fe0e034bbd5a64c86625e44390f7b to your computer and use it in GitHub Desktop.
Custom Post Type cosa sono e come utilizzarli: https://skillsandmore.org/custom-post-type-cosa-sono/
<?php
/**
* Plugin Name: Il mio primo CPT
*/
<?php
/**
* Plugin Name: Il mio primo CPT
* Plugin URI: https://skillsandmore.org
* Description: Con questo plugin creo il mio primo Custom Post Type.
* Version: 0.0.1
* Author: Andrea Barghigiani
* Author URI: https://skillsandmore.org
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
<?php
add_action( 'init', 'sam_register_first_cpt' );
/**
* Con questa funzione creo il Custom Post Type
*/
function sam_register_first_cpt() {
register_post_type( ... );
}
<?php
function sam_register_first_cpt() {
register_post_type(
'sam_portfolio',
[
'label' => __( 'Portfolio', 'sam-text'),
'public' => true,
]
);
}
<?php
$labels = [
'name' => __( 'Portfolio', 'sam-text' ),
'singular_name' => __( 'Lavoro', 'sam-text' ),
'add_new_item' => __( 'Aggiungi lavoro', 'sam-text' ),
'edit_item' => __( 'Modifica lavoro', 'sam-text' ),
'view_item' => __( 'Visualizza lavoro', 'sam-text' ),
'not_found' => __( 'Nessun lavoro trovato', 'sam-text' ),
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment