Created
January 2, 2020 10:40
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Il mio primo CPT | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'sam_register_first_cpt' ); | |
/** | |
* Con questa funzione creo il Custom Post Type | |
*/ | |
function sam_register_first_cpt() { | |
register_post_type( ... ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sam_register_first_cpt() { | |
register_post_type( | |
'sam_portfolio', | |
[ | |
'label' => __( 'Portfolio', 'sam-text'), | |
'public' => true, | |
] | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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