Giovanni Invernizzi
Forum Replies Created
-
Forum: Plugins
In reply to: [Content Cards] wp_dequeue_styleThank you! Works perfectly!
Forum: Plugins
In reply to: [EWWW Image Optimizer] jpegtran, optipng, gifsicle – SiteGroundThank you so so so and again so much, it works fine now!
Forum: Reviews
In reply to: [Contact Form 7] Spam mail issue and yahoo mail not reciveRemember to use catcha system when publishing a form – your problem does not depend on Contact Form 7.
Forum: Plugins
In reply to: [Polylang] Issue with get_posts in version 1.8Thank you very much!!
I just uploaded version 1.8.0.1 and it works perfectly:
https://www.larosaitaly.com/collezioni/?display=donnaGrazie again for your support!
Forum: Plugins
In reply to: [Polylang] Issue with get_posts in version 1.8“collezione” post type is translatable.
“manichino-type” is a custom taxonomy and needs no translation – or at least it didn’t need before version 1.8
“manichino-type” has no dynamic front-end usage, it’s used only to query a specific tax and, in this page (https://www.larosaitaly.com/collezioni/?display=donna) the value is populated by url parameter “?display=donna”Forum: Plugins
In reply to: [Polylang] Issue with get_posts in version 1.8Yes, sorry!
I upgraded to to Polylang 1.8 and immediatly I noticed that the page was showing contents in mixed language, so I added
'lang' => $currentlang,
and it worked fine – but then i tought it would be too much work to do on the entire site considering that the previous version didn’t need that parameter, so I switched bak to Polylang 1.7.12So consider that this query was working fine before update:
<?php $args_events = array( 'post_type' => 'collezione', 'manichino-type' => 'uomo', 'orderby' => 'menu_order', 'order' => 'DESC', 'posts_per_page' => -1 ); $my_appuntamenti = get_posts( $args_events ); foreach ( $my_appuntamenti as $post ) : setup_postdata ($post ); ?> CONTENT HERE <?php endforeach; wp_reset_postdata(); ?>
Forum: Plugins
In reply to: [Polylang] Issue with get_posts in version 1.8To fix the issue i added this parameter:
‘lang’ => $currentlang,But then i switched back to previous version because there are many page templates.
Forum: Plugins
In reply to: [Polylang] Issue with get_posts in version 1.8In a template file like this:
<?php
/**
* Template Name: Collezioni
*/get_header();
// recupero la variabile per mobile detect
global $detect;
// recupero la variabile per la lingua
global $currentlang;
// Parametri url
$display = $_GET[‘display’];
?><script>
$(document).ready(function() {
$(“.page-item-<?php echo $display; ?>”).addClass(‘current_page_item’);
});
</script><div class=”block_100″>
<div class=”wrapper”>
<div class=”first_page_padder”>
<ul id=”prod_grid”><?php
$module_counter = 0;
$vertical_image_array = array ( ‘1’, ‘5’, ‘7’, ’11’, ’13’, ’17’, ’19’, ’23’, ’25’, ’29’, ’31’ );
$args_events = array(
‘post_type’ => array( ‘collezione’, ‘post’ ),
‘lang’ => $currentlang,
‘manichino-type’ => $display,
‘orderby’ => ‘menu_order’,
‘order’ => ‘DESC’,
‘posts_per_page’ => -1
);
$my_appuntamenti = get_posts( $args_events );
foreach ( $my_appuntamenti as $post ) : setup_postdata ($post );
$module_counter++;
$riassunto = get_field(‘riassunto’);
// IMMAGINE DI COPERTINA – scelgo se verticale o orizzontale
if (in_array($module_counter, $vertical_image_array)) {
// IMMAGINE DI COPERTINA VERTICALE
$immagine_copertina = get_field(‘cover_img_vertical’);
// smartphone
if( $detect->isMobile() && !$detect->isTablet() ) {
$immagine_copertinaURL = $immagine_copertina[‘sizes’][‘full_smart’];
}
// tablet
elseif( $detect->isTablet() ) {
$immagine_copertinaURL = $immagine_copertina[‘sizes’][‘full_tab’];
}
// desktop
else {
$immagine_copertinaURL = $immagine_copertina[‘sizes’][‘full_desk’];
}
}
else {
// IMMAGINE DI COPERTINA ORIZZONTALE
$immagine_copertina = get_field(‘cover_img’);
// smartphone
if( $detect->isMobile() && !$detect->isTablet() ) {
$immagine_copertinaURL = $immagine_copertina[‘sizes’][‘full_smart’];
}
// tablet
elseif( $detect->isTablet() ) {
$immagine_copertinaURL = $immagine_copertina[‘sizes’][‘full_tab’];
}
// desktop
else {
$immagine_copertinaURL = $immagine_copertina[‘sizes’][‘full_desk’];
}
}
if ( $file_video_webm != ” ) {
$immagine_copertinaURL = ”;
}
if( !$detect->isMobile() ) {
$icona_collezione = get_field(‘icona_collezione’);
$icona_collezioneURL = $icona_collezione[‘sizes’][‘product_icon’];
$descrizione_aggiuntiva = get_field(‘descrizione_aggiuntiva’);
}
?>
<li class=”fader”>
<div class=”lazy lazyPreload block_bg” data-background=”<?php echo $immagine_copertinaURL; ?>” style=”background-image: url(‘<?php bloginfo(‘stylesheet_directory’); ?>/images/icons/block_preload.gif’);”></div><!– .block_bg –>
” class=”absl” title=”<?php the_title(); ?>”>
<div class=”text_place txt-bianco aligncenter bg-nero-alpha-80″>
<div class=”text_placer”>
<?php if ( $icona_collezione != ” ) : ?>
<img src=”<?php echo $icona_collezioneURL; ?>” class=”collection_icon” />
<?php else : ?>
<h3><?php the_title(); ?></h3>
<?php endif; ?>
<h3><?php echo $descrizione_aggiuntiva; ?></h3>
<div class=”cta txt-grigio-1″>
<?php $collezione = ${‘collezione_’ . $currentlang}; echo $collezione; ?>
</div><!– .cta –>
</div><!– .text_placer –>
</div><!– .text_place –><?php
endforeach;
wp_reset_postdata();
?><div class=”clearer”></div>
<?php get_template_part(‘/page-templates/theme-newsletter’); ?>
</div><!– .first_page_padder –>
</div><!– .wrapper –>
</div><!– .block_100 –><?php get_footer(); ?>
Forum: Plugins
In reply to: [Polylang] Issue with get_posts in version 1.8Hello!
You can check it out here, but in the live version you see now i switched back to Polylang previous version:
https://www.larosaitaly.com/collezioni/?display=donna
Is a unique theme for my customer so i have tons of custom queries.
In my example above i obviously forgot to close <?php the_title();
??Forum: Plugins
In reply to: Polylang – get post language when using wp_insert_postAnswer ??
function automatically_name_taccuino($post_id, $post, $update) {
$desired_type = ‘taccuino’;
if(( !in_array( $data[‘post_status’], array( ‘draft’, ‘pending’, ‘auto-draft’ ) ) ) && $desired_type === $post->post_type) {
$lang = pll_get_post_language($post_id);
if ( $lang === ‘it’ || $lang == ” ) {
$slug_taccuino = ‘taccuino’;
}
if ( $lang === ‘en’ ) {
$slug_taccuino = ‘notebook’;
}
if ( $lang === ‘fr’ ) {
$slug_taccuino = ‘cahier’;
}$keep_title = get_the_title();
$keep_post_id = get_the_ID();
$date_slug = get_the_date(‘Y-m-d’);
$post_title_parts = array();
$post_title_parts[] = $keep_title;
$post_title_parts[] = $slug_taccuino;
$post_title = implode(‘ – ‘, array_filter(array_map(‘trim’, $post_title_parts)));
$post_name = sanitize_title($post_title, $post_id);
global $wpdb;
$wpdb->update($wpdb->posts, array(‘post_name’ => $post_name), array(‘ID’ => $post_id));
}
}
add_action(‘wp_insert_post’, ‘automatically_name_taccuino’, 11, 3);