December 3, 2015 at 10:23 am
#40175
Emilio José
Participant
/**
* Añade soporte para WPML
*/
function apg_wpml() {
global $array_of_default_settings;
$options = wp_parse_args( get_option( 'interface_theme_options', array() ), interface_get_option_defaults() );
if ( function_exists( 'icl_object_id' ) ) { //Registramos los textos en WPML
do_action( 'wpml_register_single_string', 'apg_interface', 'home_slogan1', $options['home_slogan1'] );
do_action( 'wpml_register_single_string', 'apg_interface', 'home_slogan2', $options['home_slogan2'] );
do_action( 'wpml_register_single_string', 'apg_interface', 'footer_code', $options['footer_code'] );
}
}
add_action( 'init', 'apg_wpml', 15 );
if ( ! function_exists( 'interface_home_slogan' ) ) :
/**
* Display Home Slogan.
*
* Function that enable/disable the home slogan1 and home slogan2.
*/
function interface_home_slogan() {
global $array_of_default_settings;
$options = wp_parse_args( get_option( 'interface_theme_options', array() ), interface_get_option_defaults() );
$home_slogan1 = $options['home_slogan1'];
$home_slogan2 = $options['home_slogan2'];
if ( function_exists( 'icl_object_id' ) ) { //Versión 3.2 o superior
$home_slogan1 = apply_filters( 'wpml_translate_single_string', $options['home_slogan1'], 'apg_interface', 'home_slogan1' );
$home_slogan2 = apply_filters( 'wpml_translate_single_string', $options['home_slogan2'], 'apg_interface', 'home_slogan2' );
}
$interface_home_slogan = '';
if( !empty( $home_slogan1 ) || !empty( $home_slogan2 ) ) {
if ( 1 != $options[ 'disable_slogan' ] ) {
$interface_home_slogan .= '<section class="slogan-wrap"><div class="container"><div class="slogan">';
if ( !empty( $home_slogan1 ) ) {
$interface_home_slogan .= esc_html( $home_slogan1 );
}
if ( !empty( $home_slogan2 ) ) {
$interface_home_slogan .= '<span>'.esc_html( $home_slogan2 ).'</span>';
}
$interface_home_slogan .= '</div><!-- .slogan -->';
$interface_home_slogan .= '</div><!-- .container --></section><!-- .slogan-wrap -->';
}
}
echo $interface_home_slogan;
}
endif;
/**
* function to show the footer info, copyright information
*/
function apg_interface_footer_info() {
global $array_of_default_settings;
$options = wp_parse_args( get_option( 'interface_theme_options', array() ), interface_get_option_defaults() );
$footer_code = $options['footer_code'];
if ( function_exists( 'icl_object_id' ) ) { //Versión 3.2 o superior
$footer_code = apply_filters( 'wpml_translate_single_string', $options['footer_code'], 'apg_interface', 'footer_code' );
}
$interface_footer_info = '<div class="copyright">' . $footer_code . '</div><!-- .copyright -->';
echo do_shortcode( $interface_footer_info );
}
function sobrescribiendo_ganchos() {
remove_filter( 'interface_footer', 'interface_footer_info', 30 );
add_filter( 'interface_footer', 'apg_interface_footer_info', 30 );
}
add_action( 'after_setup_theme', 'sobrescribiendo_ganchos' );