Support

Account

Forum Replies Created

  • This question does not have a ‘definitive’ answer. It is personal. What works for one person might not work for others.

  • I think you need to loop through the repeater instead of applying it to the entire field.

  • I don’t quite know what the vcard syntax is, but you cn find that somewhere else.

    Looking at your code, I would do it as follows:

    $field = get_field_object("location");
    echo "<h5>" . $field['label'] . "</h5>";
    $post_object = get_field('location'); 
    if ( $post_object ) : 
    ?>
        <p><?php the_field('street_address', $post_object->ID); ?><br>
        <?php the_field('suite_office', $post_object->ID); ?><br>
        <?php the_field('city', $post_object->ID); ?>, <?php the_field('state', $post_object->ID); ?><?php the_field('zip_code', $post_object->ID); ?>
  • AAAAH you mean what the type identifier is… for in filters and so.. but you already found out 🙂

  • What don’t you understand what is explained on this page ?

    This setting stores a 1/true or 0/false ?

    What other info are you looking for ?

  • Not worth a tool tip imo. The docs are sufficient imo.

  • Google and yea shall find… Have you read this page ?

  • I’m missing which fields you’re struggling with and why ?

  • I did the same 😉 so I can understand…

  • I finally found the proper solution on what I wanted to achieve.

    Language: EN
    Field groups are not translated.
    Post type ‘profile’ set to: “Appear as translated”.

    Then by using load_field I run every (static) value that is possible/present in the form through a function which returns a translatable string.

    With this function I can now create translatable strings from an entire form instead without the need of duplicating the field group etc.

    Right now I translate the following ‘things’, but more might be added (if the need comes for it).
    – labels
    – choices
    – options
    – placeholders
    – button labels
    – instructions

    In case someone is interested, here’s the code.

    // if $field[ 'parent' ] == group_x
    if ( in_array( $field[ 'parent' ], ['group_57e3ed6c8b5f8', 'group_5938c49eb2247'] ) ) {
    
        if ( in_array( $field[ 'label' ], [ 'Tour Schedule' ] ) ) {
            $field[ 'button_label' ] = i18n_values( $field[ 'button_label' ] );
        }
    
        if ( in_array( $field[ 'label' ], [ 'Nationality' ] ) ) {
            if ( is_array( $field['choices'] ) && count( $field['choices'] ) > 0  ) {
                foreach( $field['choices'] as $key => $choice ) {
                    $field['choices'][ $key ] = i18n_countries( $choice );
                }
            }
            asort( $field['choices'] );
        }
    
        if ( in_array( $field[ 'label' ], ['Sex', 'Date type', 'Services', 'Hair colour', 'Eye colour', 'Build'] ) ) {
            if ( is_array( $field['choices'] ) && count( $field['choices'] ) > 0  ) {
                foreach( $field['choices'] as $key => $choice ) {
                    $field['choices'][ $key ] = i18n_values( $choice );
                }
            }
        }
    
        if ( in_array( $field[ 'type' ], ['true_false', 'message'] ) ) {
            $field[ 'message' ] = i18n_values( $field[ 'message' ] );
        }
    
        if ( $field[ 'type' ] == 'text' ) {
            $field[ 'placeholder' ] = i18n_values( $field[ 'placeholder' ] );
        }
    
        $field[ 'label' ]        = i18n_values( $field[ 'label' ] );
        $field[ 'instructions' ] = i18n_values( $field[ 'instructions' ] );
    }

    And I run the values through this function to translate them. It only has 1 value, but in my own file there are tons.

    function i18n_values( $value ) {
    
        $translation = $value;
        switch ( $value ) {
    
            case 'Female':
                $translation = __( 'Female', 'text-domain' );
                break;
    
        }
    
        return $translation;
    }

    i18n_countries does the same but only for country names.

  • I remember looking into the same, because I wanted to add something in my own meta box, but I wasn’t able to (or at least not in the way I wanted). I ended up writing my own custom one.

    Which events plugin is it ?

  • Sounds like an issue with the theme Wolsey. Switch to a default WP theme, then test it again.

    If it doesn’t work, deactivate all plugins and activate them one by one.

    If it still persists, I think you should ask for help with the author of Wolsey.

  • Hard to pinpoint but in case it does happen again, I’d first deactivate all plugins, if it doesn’t change anything, then change to a default theme.

    I’m fairly sure one of these should fix it.

  • I understand why you want to….

    The only way I can see how to to it, is load some jQuery on page load and set the prop to checked.

    Something like is described in this post.

  • I doubt it…

    Can you provide a bit more info ?
    I assume this is in the back-end ?

  • That sounds like a conflict with another plugin.

    Have you deactivated all plugins ?
    Have you switched back to a default WP theme ?

  • I’m not sure if it can….

    In terms of User Experience I wouldn’t do it. You force the user to a certain behaviour. I hate it when target is _blank is used. The user needs to decide whether to open in a new tab or not.

  • the_field echoes the value.
    get_field returns the value (but doesn’t echo).

    Have you tried deactivating all other plugins and revert tot a default (WP) theme ?
    Does the problem still exist then ?

  • Oh wait… it looks like your syntax is wrong.

    the_field('field_name', 'option')

  • I think where you have field_593c04d244712 it should be the name of the field, not the key.

  • You should loop through $mygallery01 and $mygallery02 not through $images.

    $images is an incorrect defined string.

    I think this will do the trick.

    $galleries = array( 'mygallery01', 'mygallery02' );
    
    if ( $galleries ) { 
        foreach( $galleries as $gallery ) { 
            $images = get_field($gallery);
            if ( $images ) {
            ?>
            <ul>
                <?php foreach( $images as $image ): ?>
                    <li>
                        <h6>by section:<?php echo $image['XXXX']; ?></h6>  
                        <a href="<?php echo $image['url']; ?>">
                             <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
                        </a>
                        <p><?php echo $image['caption']; ?></p>
                    </li>
                <?php endforeach; ?>
            </ul>
            <?php }
        }        
    }
  • Do you maybe have WPML installed ?

  • This is not question related to ACF. It’s better asked in the Twig section on Stack Overflow.

  • Have you actually tried to dump $_POST ? You then would have seen the contents and would have seen that $_POST[‘selected_model’] does not exist.

    To retrieve a posted value, you need to look into $_POST[ ‘acf’ ]. In it you will find the field keys (not the names).

    So you need to check what the field key is for your field.

    Then do something like this:

    if ( ! empty( $_POST[ 'acf' ][ 'field_5a0de683a21cf' ] ) {
        update_post_meta($post_id, 'car_model', 'field_key' );
    }
  • Not needed anymore, fixed with a WPML filter.

    function sd_change_language( $post_id ) {
    
        if ( 'post_type' == get_post_type( $post_id ) ) {
            $wpml_element_type           = apply_filters( 'wpml_element_type', 'post_type' );
            $get_language_args           = array( 'element_id' => $post_id, 'element_type' => 'post_type' );
            $original_post_language_info = apply_filters( 'wpml_element_language_details', null, $get_language_args );
            $set_language_args           = array(
                'element_id'           => $post_id,
                'element_type'         => $wpml_element_type,
                'trid'                 => $original_post_language_info->trid,
                'language_code'        => 'en', // language code to change it to
                'source_language_code' => null
            );
    
            do_action( 'wpml_set_element_language_details', $set_language_args );
        }
    }
    add_action( 'acf/save_post', 'sd_change_language', 1, 1 );
Viewing 25 posts - 76 through 100 (of 291 total)