';
$args['suffix'] = '';
$args['heirarchial_attachments'] = true; // Genesis 1.5 and later
$args['heirarchial_categories'] = true; // Genesis 1.5 and later
$args['display'] = true;
$args['labels']['prefix'] = 'Está aquí: ';
$args['labels']['author'] = ' ';
$args['labels']['category'] = ' '; // Genesis 1.6 and later
$args['labels']['tag'] = ' ';
$args['labels']['date'] = ' ';
$args['labels']['search'] = 'Buscar ';
$args['labels']['tax'] = ' ';
$args['labels']['post_type'] = ' '; //Noticias de
$args['labels']['404'] = 'No encontrado: '; // Genesis 1.5 and later
return $args;
}
//Muestra sólo posts de la Categoría de la noticia actual abierta
add_filter( 'widget_posts_args', 'my_widget_posts_args');
function my_widget_posts_args($args) {
if ( is_single()) {
$categories = get_the_category();
//echo esc_html( $categories[0]->name ); // para mostrar el nombre de la categoría
if ( ! empty( $categories ) ) {
return array(
'posts_per_page' => 8, //set the number you want here
'no_found_rows' => true,
'post_status' => 'publish',
'ignore_sticky_posts' => true,
'post__not_in' => array( get_the_ID() ),
'cat' => $categories[0] -> term_id //the current category id
);
}
}
}
/**
* Muestra los campos personalizados de Agrodigital
*/
add_action( 'genesis_before_entry', 'cf_pretitle' );
function cf_pretitle() {
if(is_page() || is_single() ) {
echo '
Procedencia: '. genesis_get_custom_field('procedencia') .'';
}
}
//* Remove the author box on single posts HTML5 Themes
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
// Replaces the excerpt "more" text by a link
function new_excerpt_more($more) {
global $post;
return '
[Leer más...]';
}
add_filter('excerpt_more', 'new_excerpt_more');
function wpbsearchform( $form ) {
$form = '
';
return $form;
}
add_shortcode('wpbsearch', 'wpbsearchform');
//* Muestra las categorías en la categoría de Legislación, en el resto se muestra una cabecera general.
function themeprefix_category_header() {
if ( is_category('Legislación') ) {
//* Add Post categories above Post title
add_action ( 'genesis_entry_header', 'sk_show_category_name', 9 );
function sk_show_category_name() {
echo do_shortcode('[post_categories before="
" after=""]');
}
} else {
echo '
';
echo single_cat_title();
echo '
';
}
}
add_action( 'genesis_before_loop' , 'themeprefix_category_header' );
//* Muestra banners de AdRotate en los blogs y noticias abiertas, en función de la categoría
function ShowBannerByCategory() {
global $sidebar_sector;
global $slugactual;
if ( is_single() ) {
$categories = get_the_category();
$slugactual = $categories[0]->slug;
} else {
$cate = get_term_by('name', single_cat_title('', false), 'category');
$slugactual = $cate->slug;
}
switch ( $slugactual ) {
/* ===========================================================
AGRICULTURA
=========================================================== */
case 'agricultura-p':
echo '
';
echo '
';
echo adrotate_group('41');
echo '
';
echo '
';
echo adrotate_group('143');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura";
break;
case "cultivos-herbaceos":
echo '
';
echo '
';
echo adrotate_group('41');
echo '
';
echo '
';
echo adrotate_group('109');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_CultivosHerbaceos";
break;
case "frutas-hortalizas":
echo '
';
echo '
';
echo adrotate_group('43');
echo '
';
echo '
';
echo adrotate_group('149');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_FrutasHortalizas";
break;
case "vino":
echo '
';
echo '
';
echo adrotate_group('44');
echo '
';
echo '
';
echo adrotate_group('110');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_Vino";
break;
case "olivar":
echo '
';
echo '
';
echo adrotate_group('45');
echo '
';
echo '
';
echo adrotate_group('111');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_Olivar";
break;
case "remolacha-azucar":
echo '
';
echo '
';
echo adrotate_group('46');
echo '
';
echo '
';
echo adrotate_group('112');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_RemolachaAzucar";
break;
case "patata":
echo '
';
echo '
';
echo adrotate_group('47');
echo '
';
echo '
';
echo adrotate_group('113');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_Patata";
break;
case "algodon":
echo '
';
echo '
';
echo adrotate_group('49');
echo '
';
echo '
';
echo adrotate_group('114');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_Algodon";
break;
case "tabaco":
echo '
';
echo '
';
echo adrotate_group('50');
echo '
';
echo '
';
echo adrotate_group('115');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_Tabaco";
break;
case "sanidad-vegetal":
echo '
';
echo '
';
echo adrotate_group('51');
echo '
';
echo '
';
echo adrotate_group('116');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_SanidadVegetal";
break;
case "insumos-agricolas":
echo '
';
echo '
';
echo adrotate_group('52');
echo '
';
echo '
';
echo adrotate_group('117');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_InsumosAgricolas";
break;
case "arroz":
echo '
';
echo '
';
echo adrotate_group('48');
echo '
';
echo '
';
echo adrotate_group('118');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Agricultura_Arroz";
break;
/* ===========================================================
GANADERÍA
=========================================================== */
case "ganaderia-p":
echo '
';
echo '
';
echo adrotate_group('75');
echo '
';
echo '
';
echo adrotate_group('144');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia";
break;
case "ganaderia":
echo '
';
echo '
';
echo adrotate_group('62');
echo '
';
echo '
';
echo adrotate_group('145');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia_Ganaderia";
break;
case "porcino":
echo '
';
echo '
';
echo adrotate_group('53');
echo '
';
echo '
';
echo adrotate_group('120');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia_Porcino";
break;
case "leche":
echo '
';
echo '
';
echo adrotate_group('54');
echo '
';
echo '
';
echo adrotate_group('121');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia_Leche";
break;
case "vacuno":
echo '
';
echo '
';
echo adrotate_group('55');
echo '
';
echo '
';
echo adrotate_group('122');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia_Vacuno";
break;
case "ovino-caprino":
echo '
';
echo '
';
echo adrotate_group('56');
echo '
';
echo '
';
echo adrotate_group('123');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia_OvinoCaprino";
break;
case "avicultura":
echo '
';
echo '
';
echo adrotate_group('57');
echo '
';
echo '
';
echo adrotate_group('124');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia_Avicultura";
break;
case "apicultura":
echo '
';
echo '
';
echo adrotate_group('58');
echo '
';
echo '
';
echo adrotate_group('125');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia_Apicultura";
break;
case "cunicultura":
echo '
';
echo '
';
echo adrotate_group('59');
echo '
';
echo '
';
echo adrotate_group('126');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia_Cunicultura";
break;
case "acuicultura":
echo '
';
echo '
';
echo adrotate_group('60');
echo '
';
echo '
';
echo adrotate_group('127');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia_Acuicultura";
break;
case "alimentacion-animal":
echo '
';
echo '
';
echo adrotate_group('61');
echo '
';
echo '
';
echo adrotate_group('128');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Ganaderia_Alimentacion";
break;
/* ===========================================================
POLÍTICA AGRARIA
=========================================================== */
case "politica-agraria-p":
echo '
';
echo '
';
echo adrotate_group('76');
echo '
';
echo '
';
echo adrotate_group('145');
echo '
';
echo '
';
$sidebar_sector = "Lateral_PoliticaAgraria_PAC";
break;
case "politica-agraria-pac":
case "pac":
echo '
';
echo '
';
echo adrotate_group('64'); // ID del banner largo PAC
echo '
';
echo '
';
echo adrotate_group('150'); // ID del banner corto PAC (el que crearás)
echo '
';
echo '
';
$sidebar_sector = "Lateral_PoliticaAgraria_PoliticaAgraria";
break;
case "politica-agraria-espana":
echo '
';
echo '
';
echo adrotate_group('65');
echo '
';
echo '
';
echo adrotate_group('129');
echo '
';
echo '
';
$sidebar_sector = "Lateral_PoliticaAgraria_PoliticaAgrariaEspaña";
break;
case "paises-terceros":
case "politica-agraria-paises-terceros":
echo '
';
echo '
';
echo adrotate_group('66');
echo '
';
echo '
';
echo adrotate_group('130');
echo '
';
echo '
';
$sidebar_sector = "Lateral_PoliticaAgraria_PaisesTerceros";
break;
case "omc-acuerdos-preferenciales":
echo '
';
echo '
';
echo adrotate_group('67');
echo '
';
echo '
';
echo adrotate_group('131');
echo '
';
echo '
';
$sidebar_sector = "Lateral_PoliticaAgraria_OMC";
break;
case "seguros-agrarios":
echo '
';
echo '
';
echo adrotate_group('68');
echo '
';
echo '
';
echo adrotate_group('132');
echo '
';
echo '
';
$sidebar_sector = "Lateral_PoliticaAgraria_SegurosAgrarios";
break;
/* ===========================================================
DESARROLLO RURAL
=========================================================== */
case "desarrollo-rural-p":
echo '
';
echo '
';
echo adrotate_group('77');
echo '
';
echo '
';
echo adrotate_group('147');
echo '
';
echo '
';
$sidebar_sector = "Lateral_DesarrolloRural";
break;
case "desarrollo-rural":
echo '
';
echo '
';
echo adrotate_group('77');
echo '
';
echo '
';
echo adrotate_group('133');
echo '
';
echo '
';
$sidebar_sector = "Lateral_DesarrolloRural";
break;
case "regadios":
echo '
';
echo '
';
echo adrotate_group('72');
echo '
';
echo '
';
echo adrotate_group('134');
echo '
';
echo '
';
$sidebar_sector = "Lateral_DesarrolloRural_Regadios";
break;
case "mujer-rural":
echo '
';
echo '
';
echo adrotate_group('101');
echo '
';
echo '
';
echo adrotate_group('135');
echo '
';
echo '
';
$sidebar_sector = "Lateral_DesarrolloRural_MujerRural";
break;
/* ===========================================================
MEDIO AMBIENTE
=========================================================== */
case "medio-ambiente-p":
echo '
';
echo '
';
echo adrotate_group('69');
echo '
';
echo '
';
echo adrotate_group('148');
echo '
';
echo '
';
$sidebar_sector = "Lateral_MedioAmbiente";
break;
case "medio-ambiente":
echo '
';
echo '
';
echo adrotate_group('69');
echo '
';
echo '
';
echo adrotate_group('136');
echo '
';
echo '
';
$sidebar_sector = "Lateral_MedioAmbiente";
break;
case "agua-sequia":
echo '
';
echo '
';
echo adrotate_group('70');
echo '
';
echo '
';
echo adrotate_group('137');
echo '
';
echo '
';
$sidebar_sector = "Lateral_MedioAmbiente_AguaSequia";
break;
case "energias-renovables":
echo '
';
echo '
';
echo adrotate_group('71');
echo '
';
echo '
';
echo adrotate_group('138');
echo '
';
echo '
';
$sidebar_sector = "Lateral_MedioAmbiente_EnergiasRenovables";
break;
case "forestal":
echo '
';
echo '
';
echo adrotate_group('102');
echo '
';
echo '
';
echo adrotate_group('139');
echo '
';
echo '
';
$sidebar_sector = "Lateral_MedioAmbiente_Forestal";
break;
/* ===========================================================
ALIMENTACIÓN
=========================================================== */
case "alimentacion-pp":
echo '
';
echo '
';
echo adrotate_group('79');
echo '
';
echo '
';
echo adrotate_group('149');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Alimentacion";
break;
case "produccion-ecologica":
echo '
';
echo '
';
echo adrotate_group('99');
echo '
';
echo '
';
echo adrotate_group('142');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Alimentacion_ProdEcologica";
break;
case "biotecnologia":
echo '
';
echo '
';
echo adrotate_group('100');
echo '
';
echo '
';
echo adrotate_group('141');
echo '
';
echo '
';
$sidebar_sector = "Lateral_Alimentacion_BioIDI";
break;
default:
$sidebar_sector = "error";
}
}
add_action( 'genesis_before_loop' , 'ShowBannerByCategory' );
//* Customize the post info function
add_filter( 'genesis_post_info', 'sp_post_info_filter' );
function sp_post_info_filter($post_info) {
if ( !is_page() ) {
$post_info = '[post_date] [post_edit]';
return $post_info;
}
}
//* Customize the entire footer
remove_action( 'genesis_footer', 'genesis_do_footer' );
add_action( 'genesis_footer', 'sp_custom_footer' );
function sp_custom_footer() {
?>
Política de Privacidad | Términos legales
Copyright © 2018 Agrodigital, S.L. · Todos los derechos reservados
is_search ) // Make sure it is a search page
$query->query_vars['posts_per_page'] = 50; // Change 50 to the number of posts you would like to show
return $query; // Return our modified query variables
}
add_filter('pre_get_posts', 'change_wp_search_size'); // Hook our custom function onto the request filter
/** Exclude certain category from posts (Legislación) */
add_action( 'pre_get_posts', 'be_exclude_category_from_blog' );
function be_exclude_category_from_blog( $query ) {
if( $query->is_home() ) {
$query->set( 'cat', '-150' ); //opinión es la 155 - antes era $query->set( 'cat', '-155,-150' )
}
}
// Deregister los dashicons si no se muestra la barra de admin
add_action( 'wp_print_styles', function() {
if (!is_admin_bar_showing()) wp_deregister_style( 'dashicons' );
}, 100);
/**
* Conditionally Change Sidebar in Genesis whilst using Simple Sidebars
*
* @package Genesis Sidebar with Simple Sidebar Switcheroo
* @author Neil Gee
* @link http://coolestguidesontheplanet.com/bulk-set-sidebar-categories-tags-simple-sidebars-installed-genesis/
* @copyright (c) 2014, Neil Gee
*/
function themeprefix_remove_sidebar() {
if ( is_single() ) { //set your connditionals here
remove_action( 'genesis_sidebar', 'ss_do_sidebar' ); //removes Simple Sidebar
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); //removes Genesis Default sidebar
add_action( 'genesis_sidebar', 'themeprefix_add_sidebar' ); //adds alternative sidebar in function below
}
}
//Alternative Sidebar
function themeprefix_add_sidebar() {
global $sidebar_sector;
dynamic_sidebar( $sidebar_sector );
}
add_action( 'genesis_before_sidebar_widget_area', 'themeprefix_remove_sidebar' ); //starts the ball rolling
//* MODIFICACION DEL AREA DE COMENTARIOS
//* ====================================
//* Modify comments title text in comments
add_filter( 'genesis_title_comments', 'topleague_genesis_title_comments' );
function topleague_genesis_title_comments() {
$title = '
Comentarios de nuestros lectores:
';
return $title;
}
//* Modify the 'Leave a Reply' title in comments
add_filter( 'comment_form_defaults', 'topleague_comment_form_defaults' );
function topleague_comment_form_defaults( $defaults ) {
$defaults['title_reply'] = __( 'Escriba un comentario:' );
return $defaults;
}
/* Inserta el código de adSense */
add_action('wp_head', 'InsertaAdSense');
function InsertaAdSense(){
?>
';
echo '
';
echo '
';
echo '';
echo '
';
}
// cambia el texto del boton publicar comentario
function cambiar_texto_boton_comentarios($defaults) {
$defaults['label_submit'] = 'Publicar comentario';
return $defaults;
}
add_filter('comment_form_defaults', 'cambiar_texto_boton_comentarios');
// Cambiar título dinámico de los widgets
add_filter( 'widget_title', 'agro_dynamic_sector_widget_title', 10, 3 );
function agro_dynamic_sector_widget_title( $title, $instance = null, $id_base = null ) {
// Solo actúa en entradas individuales sobre el widget de posts recientes
if ( is_single() && $id_base === 'recent-posts' ) {
$categories = get_the_category();
if ( !empty($categories) ) {
$name = $categories[0]->name;
$cat_upper = function_exists('mb_strtoupper') ? mb_strtoupper($name, 'UTF-8') : strtoupper($name);
// Devolvemos dos spans para aplicar estilos distintos
return '
Política de comentarios:
Tenemos tolerancia cero con el spam y con los comportamientos inapropiados. Agrodigital se reserva el derecho de eliminar sin previo aviso aquellos comentarios que no cumplan las normas que rigen esta sección.