Support

Account

Forum Replies Created

  • This is what I’ve done so far. What this does is it adds the class .current to the selected checkbox and hide the rest. The problem I have now is that when you uncheck the box, the class .current is still there and when you check on another checkbox, it doesn’t work at all.

    $(document).on("click", "#three_img_plus_feature_img input", function () {
        $("#three_img_plus_feature_img").removeClass('current');
        $(this).closest("#three_img_plus_feature_img").addClass('current');
    
        if ($(this).is(":checked")) {
            $("#three_img_plus_feature_img:not(.current) label").css("display", "none");
        } else {
            $("#three_img_plus_feature_img:not(.current) label").css("display", "block");
        }
    });
  • Nevermind, I figured out my problem and forgot to update.

  • Thanks everyone for the help but it didn’t work so I re-did everything by adding another flexible content field inside another flexible content field like this:

    – IRL today data (flexible content)
    – Website (flexible content)
    – Image
    – Social (flexible content)
    – Text field

    Now I’m trying to find a way to count items inside an array. For example, when I run a print_r:

        <pre>
        <?php print_r(get_field('irl_today_entry', $post_id));?>
        </pre>

    It prints out:

    Array
    (
        [0] => Array
            (
                [acf_fc_layout] => irl_today_website_entry
                [irl_today_website] => Array
                    (
                        [0] => Array
                            (
                                [acf_fc_layout] => irl_today_img_website
                                [image_of_website] => http://soundboard.local/wp-content/uploads/2019/09/FireShot-Capture-003-Apple-Google-Pull-Hong-Kong-Protest-Apps-Amid-China-Uproar-WSJ_-www.wsj_.com_.png
                            )
    
                        [1] => Array
                            (
                                [acf_fc_layout] => irl_today_img_website
                                [image_of_website] => http://soundboard.local/wp-content/uploads/2019/09/FireShot-Capture-005-Apple-CEO-Tim-Cook-defends-decision-to-remove-an-app-used-by-Hong-Kon_-www.cnn_.com_.png
                            )
    
                    )
    
            )
    
        [1] => Array
            (
                [acf_fc_layout] => irl_today_social_entry
                [irl_today_social] => Array
                    (
                        [0] => Array
                            (
                                [acf_fc_layout] => irl_today_social_media
                                [social_media_network] => twitter
                                [social_media_username] => randouser
                                [text_of_social_media] => text removed
                                [url_to_social_media_post] => 
                                [social_media_date_published] => 
                            )
    
                        [1] => Array
                            (
                                [acf_fc_layout] => irl_today_social_media
                                [social_media_network] => twitter
                                [social_media_username] => randouser
                                [text_of_social_media] => text removed
                                [social_media_date_published] => 
                            )
    
                    )
    
            )
    
    )

    How do I count the items in [irl_today_social] without using any number?

  • So I tried using this solution from https://support.advancedcustomfields.com/forums/topic/return-all-values-from-a-repeater-row-by-using-a-single-dynamic-select/ and it deletes the select field and adds two random blank fields

    function acf_load_contact_field_choices( $field ) {
        
    		// reset choices
    		$field['choices'] = array();
    	
    		// if has rows
    		if( have_rows('media_playlist') ) {
    			// while has rows
    			while( have_rows('media_playlist') ) {
    				// instantiate row
    				the_row();
    				
    				// vars
    				$contactName = the_sub_field('playlist_title');
    	
    				// append to choices
    				$field['choices'][ $contactName ] = $contactName;
    			}
    		}
    	
    		// return the field
    		return $field;
    		
    	}
    	add_filter('acf/load_field/name=color', 'acf_load_color_field_choices');
  • What if there’s multiple choices?

    $status_active = get_field('breaking_news_status', $post_id) == 'active';
                    if (!in_array('breaking_news_status', $status_active)) {
                        $status_active[] = 'status_locked';
                        update_field('breaking_news_status', $status_active, $post_id);
                    };
  • I’m using a shortcode that I insert into the editor so it would be best if I can wrap a Div around it.

Viewing 9 posts - 1 through 9 (of 9 total)