Support

Account

Home Forums Gutenberg Block WPML

Unread

Block WPML

  • Hello!

    The new blocks with ACF are awesome and I really love this feature.
    In the combination with WPML the debug.log gives an error.
    This only happend when I use $images = get_field('logos'); in a piece of block code.

    Here is the full code. Am I doing something wrong or is this an unexpected bug?


    <?php
    /**
    * Partners Block Template.
    *
    * @param array $block The block settings and attributes.
    * @param string $content The block inner HTML (empty).
    * @param bool $is_preview True during AJAX preview.
    * @param (int|string) $post_id The post ID this block is saved to.
    */

    // Create id attribute allowing for custom “anchor” value.
    $id = ‘partners-‘ . $block[‘id’];
    if( !empty($block[‘anchor’]) ) {
    $id = $block[‘anchor’];
    }

    // Create class attribute allowing for custom “className” and “align” values.
    $className = ‘partners’;
    if( !empty($block[‘className’]) ) {
    $className .= ‘ ‘ . $block[‘className’];
    }
    if( !empty($block[‘align’]) ) {
    $className .= ‘ align’ . $block[‘align’];
    }

    // Load values and assing defaults.
    $title = get_field(‘title’) ?: ‘Your title here…’;
    $images = get_field(‘logos’);
    $size = ‘thumbnail’; // (thumbnail, medium, large, full or custom size)
    ?>

    <div id=”<?php echo esc_attr($id); ?>” class=”<?php echo esc_attr($className); ?> partners”>

    <h1 class=”header”>
    <?php echo $title; ?>
    </h1>

    <?php if( isset($images) ): ?>
    <ul class=”partners”>
    <?php foreach( $images as $image ): ?>
    <li style=”background-image: url(<?php echo $image[‘url’]; ?>)”>
    <?php //echo wp_get_attachment_image( $image[‘ID’], $size ); ?>

    <?php endforeach; ?>

    <?php endif; ?>

    </div>

    The debug error:
    [19-Jun-2019 07:46:00 UTC] PHP Warning: Illegal offset type in isset or empty in /www/wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-element-translation.php on line 247
    [19-Jun-2019 07:46:00 UTC] PHP Notice: wpdb::prepare werd verkeerd aangeroepen. De query verwachtte één placeholder, maar er is een array met meerdere placeholders verzonden. Lees Foutopsporing in WordPress voor meer informatie. (Dit bericht is toegevoegd in versie 4.9.0.) in /www/wp-includes/functions.php on line 4773
    [19-Jun-2019 07:46:00 UTC] WordPress databasefout You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ” at line 9 bij query SELECT wpml_translations.translation_id, wpml_translations.element_id, wpml_translations.language_code, wpml_translations.source_language_code, wpml_translations.trid, wpml_translations.element_type
    FROM wp_icl_translations wpml_translations
    JOIN wp_posts p
    ON wpml_translations.element_id = p.ID
    AND wpml_translations.element_type = CONCAT(‘post_’, p.post_type)
    JOIN wp_icl_translations tridt
    ON tridt.element_type = wpml_translations.element_type
    AND tridt.trid = wpml_translations.trid
    WHERE gemaakt door require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/bird1.91/single-venue.php’), the_content, apply_filters(‘the_content’), WP_Hook->apply_filters, do_blocks, render_block, WP_Block_Type->render, render_block_core_block, do_blocks, render_block, WP_Block_Type->render, acf_rendered_block, acf_render_block, include(‘/themes/bird1.91/blocks/partners.php’), get_field, acf_get_value, apply_filters(‘acf/load_value’), WP_Hook->apply_filters, _acf_apply_hook_variations, apply_filters_ref_array(‘acf/load_value/type=gallery’), WP_Hook->apply_filters, WPML_ACF_Attachments->load_translated_attachment, apply_filters(‘wpml_object_id’), WP_Hook->apply_filters, wpml_object_id_filter, SitePress->get_object_id, WPML_Element_Translation->element_id_in, WPML_Element_Translation->maybe_populate_cache
    [19-Jun-2019 07:46:00 UTC] PHP Warning: Illegal offset type in isset or empty in /www/wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-element-translation.php on line 257
    [19-Jun-2019 07:46:00 UTC] PHP Warning: Illegal offset type in /www/wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-element-translation.php on line 258
    [19-Jun-2019 07:46:00 UTC] PHP Warning: Illegal offset type in isset or empty in /www/wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-element-translation.php on line 262

    All the best,

    Jonas

Viewing 1 post (of 1 total)

The topic ‘Block WPML’ is closed to new replies.