156 lines
5.7 KiB
PHP
156 lines
5.7 KiB
PHP
|
<?php
|
||
|
function anorgatarrak_scripts() {
|
||
|
//CSS
|
||
|
wp_enqueue_style( 'style', get_stylesheet_uri() );
|
||
|
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/node_modules/bootstrap/dist/css/bootstrap.min.css',false,'1.1','all');
|
||
|
wp_enqueue_style( 'anorgatarrak', get_template_directory_uri() . '/css/anorgatarrak.css',false,'1.1','all');
|
||
|
wp_enqueue_style( 'slideshow', get_template_directory_uri() . '/node_modules/simple-slideshow/src/slideshow.css',false,'1.1','all');
|
||
|
wp_enqueue_style( 'google-fonts', 'https://fonts.googleapis.com/css?family=Montserrat|Nothing+You+Could+Do|Roboto',false,'1.1','all');
|
||
|
//Scripts
|
||
|
wp_enqueue_script('html5shiv', 'https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js');
|
||
|
wp_enqueue_script('respond', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js');
|
||
|
wp_enqueue_script('slideshow', get_template_directory_uri() .'/node_modules/simple-slideshow/src/slideshow.js');
|
||
|
wp_enqueue_script('jquery', get_template_directory_uri() .'/node_modules/jquery/dist/jquery.min.js');
|
||
|
wp_enqueue_script('bootstrap', get_template_directory_uri() .'/node_modules/bootstrap/dist/js/bootstrap.min.js');
|
||
|
wp_enqueue_script('angularjs', get_template_directory_uri() .'/node_modules/angular/angular.js');
|
||
|
wp_enqueue_script('angularjs-route', get_template_directory_uri() .'/node_modules/angular-route/angular-route.js');
|
||
|
wp_enqueue_script('angularjs-sanitize', get_stylesheet_directory_uri() . '/node_modules/angular-sanitize/angular-sanitize.min.js');
|
||
|
wp_enqueue_script('anorgatarrak', get_template_directory_uri() .'/app/anorgatarrak.js');
|
||
|
wp_enqueue_script('catalog-module', get_template_directory_uri() .'/app/catalog/catalog.module.js');
|
||
|
wp_enqueue_script('catalog-config', get_template_directory_uri() .'/app/catalog/catalog.config.js');
|
||
|
wp_enqueue_script('catalog-component', get_template_directory_uri() .'/app/catalog/catalog.component.js');
|
||
|
wp_enqueue_script('item-module', get_template_directory_uri() .'/app/catalog/item.module.js');
|
||
|
wp_enqueue_script('item-component', get_template_directory_uri() .'/app/catalog/item.component.js');
|
||
|
//TEMPLATES
|
||
|
wp_localize_script('anorgatarrak', 'localized', array('partials' => 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' => 'entrevista'),
|
||
|
)
|
||
|
);
|
||
|
//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,array(100,100),true);
|
||
|
$_data['featured_image_thumbnail_url'] = $thumbnail[0];
|
||
|
$_data['excerpt_clean'] = strip_tags(get_the_excerpt($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 '<p>Datos relativos a las entrevistas</p>';
|
||
|
}
|
||
|
|
||
|
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'),
|
||
|
));
|
||
|
}
|
||
|
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_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' => '<div class="collapse navbar-collapse" id="an-navbar-collapse">',
|
||
|
'after_widget' => '</div>',
|
||
|
'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');
|
||
|
|
||
|
?>
|