Skip to content

Instantly share code, notes, and snippets.

@sergiohidalgo
Last active March 14, 2016 15:20
Show Gist options
  • Select an option

  • Save sergiohidalgo/7e5f43c86e7b8059c762 to your computer and use it in GitHub Desktop.

Select an option

Save sergiohidalgo/7e5f43c86e7b8059c762 to your computer and use it in GitHub Desktop.
Custom Wordpress
<?
$page = acf_add_options_page(array(
'page_title' => 'Configuraciones generales',
'menu_title' => 'Configuraciones generales',
'menu_slug' => 'configuraciones-generales',
'capability' => 'edit_posts',
'position' => 10,
'redirect' => false,
'icon_url' => 'dashicons-align-right'
));
/*
//Sub page
acf_add_options_sub_page(array(
'title' => 'Pantalla inicial',
'page_title' => 'Pantalla inicial',
'parent' => 'Contenido',
'capability' => 'manage_options'
));
*/
<?php
// Register Custom Post Type
function custom_post_type_proyecto() {
$nombre_singular = 'Proyecto';
$nombre_plural = 'Proyectos';
$icono_menu = 'dashicons-portfolio'; // https://developer.wordpress.org/resource/dashicons/
$labels = array(
'name' => _x( $nombre_plural, 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( $nombre_singular, 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( $nombre_plural, 'text_domain' ),
'name_admin_bar' => __( $nombre_plural, 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( "Todas las $nombre_plural", 'text_domain' ),
'add_new_item' => __( "Añadir nuevo $nombre_singular", 'text_domain' ),
'add_new' => __( 'Añadir nuevo', 'text_domain' ),
'new_item' => __( 'Nuevo Item', 'text_domain' ),
'edit_item' => __( 'Editar Item', 'text_domain' ),
'update_item' => __( 'Update Item', 'text_domain' ),
'view_item' => __( 'Ver Item', 'text_domain' ),
'search_items' => __( 'Buscar Item', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
'items_list' => __( 'Items list', 'text_domain' ),
'items_list_navigation' => __( 'Items list navigation', 'text_domain' ),
'filter_items_list' => __( 'Filter items list', 'text_domain' ),
);
$args = array(
'label' => __( $nombre_singular, 'text_domain' ),
'description' => __( $nombre_plural, 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => $icono_menu,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'query_var' => true,
'rewrite' =>true,
'capability_type' => 'post',
'with_front' => true,
'post-thumbnails' => true
);
register_post_type( $nombre_plural, $args );
}
add_action( 'init', 'custom_post_type_proyecto', 0 );
<?php
add_action( 'init', 'create_estado_proyectos_taxonomies', 0 );
function create_estado_proyectos_taxonomies() {
$nombre_plural = 'Estado Proyectos';
$nombre_singular = 'Estado Proyecto';
$labels = array(
'name' => _x( $nombre_plural, 'taxonomy general name' ),
'singular_name' => _x( $nombre_singular, 'taxonomy singular name' ),
'search_items' => __( 'Search ' . $nombre_plural ),
'popular_items' => __( 'Popular ' . $nombre_plural ),
'all_items' => __( 'All ' . $nombre_plural ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit ' . $nombre_singular ),
'update_item' => __( 'Update ' . $nombre_singular ),
'add_new_item' => __( 'Add New ' . $nombre_singular ),
'new_item_name' => __( 'New ' . $nombre_singular . ' Name' ),
'separate_items_with_commas' => __( 'Separate estado with commas' ),
'add_or_remove_items' => __( 'Add or remove ' . $nombre_plural),
'choose_from_most_used' => __( 'Choose from the most used ' . $nombre_plural ),
'not_found' => __( 'No writers found.' ),
'menu_name' => __( $nombre_plural ),
);
$args = array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'estado-proyectos' ),
);
register_taxonomy( 'estado-proyectos', 'proyectos', $args );
}
/*
Theme Name: My Theme
Theme URI: http://www.website.com/
Author: Sergio Hidalgo
Author URI: https://www.sergiohidalgo.cl/
Description:
Version: 0.0.0
License:
License URI:
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment