get_template_directory_uri() . '/partials/')); } function create_posttype() { //Add Slidehow type register_post_type('slideshow', array( 'labels' => array( 'name' => __( 'Slides'), 'singular_name' => __('Slide') ), 'supports' => array( 'title', 'excerpt', 'thumbnail' ), 'show_in_rest' => true, 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'slideshow'), ) ); //Add Entrevista type register_post_type('entrevista', array( 'labels' => array( 'name' => __('Entrevistas'), 'singular_name' => __('Entrevista') ), 'supports' => array('title','thumbnail'), 'show_in_rest' => true, 'public' => true, 'rewrite' => array('slug' => 'catalog'), ) ); //Add Persona register_post_type('entidad', array( 'labels' => array( 'name' => __('Personas'), 'singular_name' => __('Persona') ), 'supports' => array('thumbnail','title'), 'show_in_rest' => true, 'public' => true, 'rewrite' => array('slug'=> 'entidad'), ) ); //ADD EXCERPT TO PAGES add_post_type_support( 'page', 'excerpt' ); } function my_rest_prepare_slideshow($data,$post,$request) { $_data = $data->data; $thumbnail_id = get_post_thumbnail_id($post->ID); #$thumbnail = wp_get_attachment_image_src ($thumbnail_id); $thumbnail = wp_get_attachment_image_src ($thumbnail_id,'full',false); $_data['featured_image_thumbnail_url'] = $thumbnail[0]; $_data['excerpt_clean'] = strip_tags(get_the_excerpt($post->ID)); $data->data = $_data; return $data; } function my_rest_prepare_entrevista($data,$post,$request) { $_data = $data->data; //thumbnail $thumbnail_id = get_post_thumbnail_id($post->ID); $thumbnail = wp_get_attachment_image_src ($thumbnail_id); $_data['featured_image_thumbnail_url'] = $thumbnail[0]; //category $_data['category'] = wp_get_post_terms($post->ID,'termino'); //acf $_data['e_idioma'] = get_field('idioma',$post->ID); $_data['e_informantes'] = get_field('informantes',$post->ID); $_data['e_audiovisual'] = get_field('audiovisual',$post->ID); $_data['e_transcripcion'] = get_field('transcripcion',$post->ID); $_data['e_fecha_de_entrevista'] = get_field('fecha_de_entrevista',$post->ID); $_data['e_localizacion'] = get_field('lugar',$post->ID); $data->data = $_data; return $data; } function anorgatarrak_metabox() { add_meta_box('entrevista-anorgatarrak-metabox',__('Datos entrevista'),'cd_metabox_entrevista', 'entrevista','normal','high'); } function cd_metabox_entrevista() { echo '
Datos relativos a las entrevistas
'; } function remove_menus(){ remove_menu_page( 'edit-comments.php' ); //Comments remove_menu_page( 'edit.php' ); //Posts } function create_anorgatarrak_tesaurus() { register_taxonomy( 'termino', 'entrevista', array( 'label' => __('Terminos'), 'rewrite' => array('slug'=> 'termino'), 'hierarchical' => true, ) ); register_taxonomy('profesion','entidad', array ( 'label' => __('Profesiones'), 'rewrite' => array('slug' => 'profesion'), )); register_taxonomy('etapas','entrevista',array( 'label' => _('Etapas del proyecto'), 'rewrite' => array('slug' => 'etapas'), )); } add_action( 'init', 'create_anorgatarrak_tesaurus' ); add_action( 'admin_menu', 'remove_menus' ); add_filter('rest_prepare_slideshow','my_rest_prepare_slideshow', 12, 3); add_filter('rest_prepare_entrevista','my_rest_prepare_entrevista', 12, 3); add_filter('rest_prepare_post','my_rest_prepare_slideshow', 12, 3); add_filter('rest_prepare_page','my_rest_prepare_slideshow', 12, 3); add_theme_support( 'post-thumbnails' ); add_action('init','create_posttype'); //add_action('add_meta_boxes','anorgatarrak_metabox'); add_action('wp_enqueue_scripts', 'anorgatarrak_scripts'); add_action( 'widgets_init', 'anorgatarrak_widgets_init' ); function anorgatarrak_widgets_init() { register_sidebar( array( 'name' => __( 'Main Sidebar', 'anorgatarrak' ), 'id' => 'sidebar-anorgatarrak-1', 'class' => '', 'description' => __( 'Widgets on header', 'anorgatarrak' ), 'before_widget' => ' ', 'before_title' => '', 'after_title' => '', ) ); } function register_anorgatarrak_menu() { register_nav_menu( 'header-menu-anorgatarrak',__( 'Header Menu Anorgatarrak' ) ); register_nav_menu( 'footer-menu-anorgatarrak',__( 'Footer Menu Anorgatarrak' ) ); } add_action( 'init', 'register_anorgatarrak_menu' ); function my_acf_google_map_api( $api ){ $api['key'] = 'AIzaSyCASefiswqiqrc74Ebs68_HI6vubGJMR9M'; return $api; } add_filter('acf/fields/google_map/api', 'my_acf_google_map_api'); ?>