Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

FAQ – Preguntas Frecuentes

Añade un post type para preguntas frecuentes, comportamiento de paginas y sin comentarios

if ( ! function_exists('faq_function') ) {

// Register Custom Post Type
function faq_function() {

	$labels = array(
		'name'                  => _x( 'Preguntas', 'Post Type General Name', 'faq_function' ),
		'singular_name'         => _x( 'Pregunta', 'Post Type Singular Name', 'faq_function' ),
		'menu_name'             => __( 'Preguntas', 'faq_function' ),
		'name_admin_bar'        => __( 'Preguntas', 'faq_function' ),
		'archives'              => __( 'Archivo de preguntas', 'faq_function' ),
		'attributes'            => __( 'Item Attributes', 'faq_function' ),
		'parent_item_colon'     => __( 'Pregunta padre', 'faq_function' ),
		'all_items'             => __( 'Todas las preguntas', 'faq_function' ),
		'add_new_item'          => __( 'Añadir nueva pregunta', 'faq_function' ),
		'add_new'               => __( 'Añadir nueva', 'faq_function' ),
		'new_item'              => __( 'Nueva pregunta', 'faq_function' ),
		'edit_item'             => __( 'Editar pregunta', 'faq_function' ),
		'update_item'           => __( 'Actualizar pregunta', 'faq_function' ),
		'view_item'             => __( 'Ver pregunta', 'faq_function' ),
		'view_items'            => __( 'Ver preguntas', 'faq_function' ),
		'search_items'          => __( 'Buscar pregunta', 'faq_function' ),
		'not_found'             => __( 'No encontrado', 'faq_function' ),
		'not_found_in_trash'    => __( 'No encontrado en papelera', 'faq_function' ),
		'featured_image'        => __( 'Imagen destacada', 'faq_function' ),
		'set_featured_image'    => __( 'Configurar imagen destacada', 'faq_function' ),
		'remove_featured_image' => __( 'Remover imagen destacada', 'faq_function' ),
		'use_featured_image'    => __( 'Usar como imagen destacada', 'faq_function' ),
		'insert_into_item'      => __( 'Insertar en la pregunta', 'faq_function' ),
		'uploaded_to_this_item' => __( 'Subir a esta pregunta', 'faq_function' ),
		'items_list'            => __( 'Lista de preguntas', 'faq_function' ),
		'items_list_navigation' => __( 'Navegación de la lista de preguntas', 'faq_function' ),
		'filter_items_list'     => __( 'Filtrar lista de preguntas', 'faq_function' ),
	);
	$rewrite = array(
		'slug'                  => 'pregunta',
		'with_front'            => true,
		'pages'                 => true,
		'feeds'                 => true,
	);
	$args = array(
		'label'                 => __( 'Pregunta', 'faq_function' ),
		'description'           => __( 'Para preguntas frecuentes', 'faq_function' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'revisions', 'custom-fields' ),
		'taxonomies'            => array( 'preguntas_taxonomy' ),
		'hierarchical'          => true,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 20,
		'menu_icon'             => 'dashicons-info',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => true,
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'rewrite'               => $rewrite,
		'capability_type'       => 'page',
	);
	register_post_type( 'Preguntas', $args );

}
add_action( 'init', 'faq_function', 0 );

}