'-1', 'grafico' => "si", 'informe' => "si" ), $atts, 'balance_social' ); if($atts['year'] != "-1"): $output = "
"; $output.= '

Datos del Balance Social'." '".$atts['year'].'

'; if($atts['grafico']=="si"){ $imagen = get_post_meta( get_the_ID(), 'grafico_'.$atts['year']); $output.="
"; } if($atts['informe']=="si"){ $imagen = get_post_meta( get_the_ID(), 'informe_'.$atts['year']); $output.="
".do_shortcode($imagen[0])."
"; } $output.="
"; endif; return $output; } add_shortcode( 'balance_social', 'balance_social_func' ); function adding_custom_meta_boxes( $post_type, $post ) { add_meta_box( 'balance_social', __( 'Balance Social' ), 'balance_social_callback', 'project', 'normal', 'default' ); } add_action( 'add_meta_boxes', 'adding_custom_meta_boxes', 10, 2 ); function balance_social_callback( $post, $args = array() ) { global $year; echo "Aquí introduciremos todos los valores para el balance social"; echo "

Gráfico

"; imagen_wordpress($post,"grafico", $year); echo "

Informe

"; campo_editor_wordpress($post,"informe", $year); } function imagen_wordpress($post, $variable, $year){ $stored_meta = get_post_meta( $post->ID ); ?>

ID, $variable.'_'.$year, TRUE); if (!$contenido) $contenido = ''; wp_editor( $contenido, $variable.'_'.$year, array('textarea_rows' => '10', media_buttons => true)); } add_action( 'save_post', 'balance_social_save_custom_fields', 10, 2 ); function balance_social_save_custom_fields( $post_id, $post ){ global $year; if( isset( $_POST['grafico_'.$year] ) && $_POST['grafico_'.$year] != "" ) { update_post_meta( $post_id, 'grafico_'.$year, $_POST['grafico_'.$year] ); } if( isset( $_POST['informe_'.$year] ) && $_POST['informe_'.$year] != "" ) { update_post_meta( $post_id, 'informe_'.$year, $_POST['informe_'.$year] ); } } function mostrar_categorias_proyecto() { // Get post by post ID. $post = get_post( $post->ID ); // Get post type by post. $post_type = $post->post_type; // Get post type taxonomies. $taxonomies = get_object_taxonomies( $post_type, 'objects' ); $out = array(); foreach ( $taxonomies as $taxonomy_slug => $taxonomy ){ // Get the terms related to post. $terms = get_the_terms( $post->ID, $taxonomy_slug ); if ( ! empty( $terms ) ) { foreach ( $terms as $term ) { $out[] = sprintf( '%1$s', esc_html( $term->name ) ); } } } return implode( '', $out ); } function mostrar_categorias_id() { // Get post by post ID. $post = get_post( $post->ID ); // Get post type by post. $post_type = $post->post_type; // Get post type taxonomies. $taxonomies = get_object_taxonomies( $post_type, 'objects' ); foreach ( $taxonomies as $taxonomy_slug => $taxonomy ){ // Get the terms related to post. $terms = get_the_terms( $post->ID, $taxonomy_slug ); if ( ! empty( $terms ) ) { foreach ( $terms as $term ) { $out .= $term->term_id."|"; } } } return $out; } function controladores_css(){ $categorias = explode("|", mostrar_categorias_id(), -1); foreach($categorias as $categoria){ $controlador.= "ff-item-type-".$categoria." "; } echo $controlador; } ?>