I'm trying to understand plugins by making one. It puts a new menu to Wordpress Admin menu "Propagandas (ads)", which creates a post type "propaganda_item".
Since I need the user to choose a State/City for each "Propaganda", I've made an SQL table with City/State.
So far, so good, but now I don't know how to put the php select combobox in the "Propaganda" edit page. Example of what I mean
Actually I know how to populate the Select, but not how to put it within the post through my plugin.
Oh, and here is my plugin code:
<?php
/*
Plugin Name: Frankec
Plugin URI:
Description: propagandas
Version:1
Author URI:
*/?>
<?php// Registra Propagandas
function register_cpt_Propagandas() {
$labels = array(
'name' => _x( 'Propagandas', 'propaganda_item' ),
'singular_name' => _x( 'Propagandas', 'propaganda_item' ),
'add_new' => _x( 'Nova', 'propaganda_item' ),
'add_new_item' => _x( 'Adicionar Propagandas', 'propaganda_item' ),
'edit_item' => _x( 'Editar Propagandas', 'propaganda_item' ),
'new_item' => _x( 'Nova Propagandas', 'propaganda_item' ),
'view_item' => _x( 'Ver Propagandas', 'propaganda_item' ),
'search_items' => _x( 'Procurar Propagandas', 'propaganda_item' ),
'not_found' => _x( 'Nenhuma Propaganda encontrada', 'propaganda_item' ),
'not_found_in_trash' => _x( 'Nenhuma Propaganda encontrada no lixo', 'propaganda_item' ),
'parent_item_colon' => _x( 'Propagandas-pai:', 'propaganda_item' ),
'menu_name' => _x( 'Propagandas', 'propaganda_item' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'description' => 'Propagandas por Cateoria',
'supports' => array( 'title', 'editor', 'thumbnail'),
'taxonomies' => array( 'genres' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-images-alt2',
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'propaganda_item', $args );
}
add_action( 'init', 'register_cpt_Propagandas' );
function remove_menus(){
remove_menu_page( 'edit-comments.php' ); //Comments
}
add_action( 'admin_menu', 'remove_menus' );
?>
Thanks in advance guys! =)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire