Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

topic

  • Unread

    Tabs with looping text and gallery

    Hi all, I have a client that is requesting a tricky template layout for a course details page(s). The page (built in elementor) will have a tab widget area which will need to be a repeater/loop, inside each tab will be text content and a gallery. Is this something possible with ACF, where within a post type there are custom loops that can include text and a gallery.
    Hope you understand!
    And tia!

  • Unread

    Dynamic Link field urls

    Curerntly all URLS used by “Link” field are stored hardcoded including the domain.
    When deploying a page to another server you have to manually update all links using the dashboard or some sql script.

    Links should use wp options siteurl to determine the domain name of a link making it portable.

  • Unread

    Saving dynamically populated group sub fields

    I have a custom post type “Client”, and a custom taxonomy “Region”. I would like to set a different “logo weight” value for each client’s region, and store it in a region_weights array.
    I created a region_weights ACF field of type “Group”, into which i want to dynamically include the sub fields (1 per region attached to the client).

    
    define('REGION_WEIGHTS_FIELD_KEY', 'field_6668114add626');
    
    add_filter('acf/prepare_field/key=' . REGION_WEIGHTS_FIELD_KEY, 'prepare_region_weights_field');
    
    function prepare_region_weights_field($field)
    {
        global $post;
    
        // Only apply this to the 'region_weights' field group
        if ($field['_name'] !== 'region_weights' || $post->post_type !== 'client') {
            return $field;
        }
    
        // Get the regions associated with this client
        $regions = wp_get_post_terms($post->ID, 'region');
    
        if (is_wp_error($regions) || empty($regions)) {
            return false; // No regions, no fields to display
        }
    
        $field_value = get_post_meta($post->ID, REGION_WEIGHTS_FIELD_KEY, true);
    
        // Generate a field for each region
        foreach ($regions as $region) {
            $field_name = 'field_region_weights_' . $region->term_id;
    
            $default_value = isset($field_value[$field_name]) ? $field_value[$field_name] : 0;
            $region_field = array(
                'key' => $field_name,
                'label' => $region->name . ' Logo Weight',
                'name' => $field_name, // Use the correct field name
                'type' => 'select',
                'instructions' => 'How often should the ' . $region->name . ' logo appear?',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => '',
                    'id' => '',
                ),
                'choices' => array(
                    0 => 'Logo should not appear',
                    1 => 'Logo should appear once in a while',
                    2 => 'Logo should appear pretty often',
                    3 => 'Logo should appear most often',
                ),
                'default_value' => $default_value,
                'value' => $default_value, // Use the correctly formatted meta key for the value
                '_name' => 'region_weights',
                'parent' => $field['key'],
                '_valid' => 1,
            );
            $field['sub_fields'][] = $region_field;
        }
        // Replace the original field with the generated fields
        return $field;
    }
    

    That part works. What does not work is that i cannot save the fields. The update_field function I attached to the ‘acf/save_post’ action hook returns false and I fail to see why. Can you help ?

    
    add_action('save_post', 'save_client_regionWeights');
    
    function save_client_regionWeights($post_id)
    {
    
        // Check if we're saving a 'client' post type
        if (get_post_type($post_id) !== 'client') {
            return;
        }
    
        // Check user permissions
        if (!current_user_can('edit_post', $post_id)) {
            return;
        }
    
        // Check if it's an autosave
        if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
            return;
        }
    
        // Check if ACF data is being saved
        if (!isset($_POST['acf'])) {
            return;
        }
    
        if (!isset($_POST['acf'][REGION_WEIGHTS_FIELD_KEY])) {
            return;
        }
    
        // Get the regions associated with this client
        $regions = wp_get_post_terms($post_id, 'region');
        if (is_wp_error($regions) || empty($regions)) {
            // No regions, nothing to save
            return;
        }
    
        // Prepare an array to hold our region weights data
        $region_weights_data = array();
    
        // Loop through each region and collect the weight data from $_POST
        foreach ($regions as $region) {
            $field_name = 'field_region_weights_' . $region->term_id;
            if (isset($_POST['acf'][REGION_WEIGHTS_FIELD_KEY][$field_name])) {
                // Add this region's weight to our data array
                $region_weights_data[$field_name] = $_POST['acf'][REGION_WEIGHTS_FIELD_KEY][$field_name];
            } else {
                // If no weight was set, default to 0
                $region_weights_data[$field_name] = 0;
            }
        }
    
        // Update the region weights data
        update_field(REGION_WEIGHTS_FIELD_KEY, $region_weights_data, $post_id);
    }
    

    If I print the content of $_POST[‘acf’] I get sensible data:

    
    Array
    (
        [field_646f1e398ee52] => Client Something
        [field_63c684c9f2e59] => 95926
        [field_63c93f5d38405] => 95921
        [field_65cde112bc88c] => 2
        [field_6668114add626] => Array
            (
                [field_region_weights_315] => 2
            )
    
    )
    

    What am I doing wrong ?

  • Unread

    Display Taxonomy Names on the Front-end via Checkbox

    I have been searching for a fix for this and have not found any solutions that have worked for me. It has to be something simple I am missing.

    I have created a new Field Group > Field Type > Taxonomy with the multi checkbox appearance. Taxonomy is selected, Save Terms is selected and Load Terms is selected. I am using Term ID for the value.

    I am using this snippet below, attached to a query, I got from this site to pull the values of the selected checkboxes on the front-end:

    <?php $terms = get_field('app_sort_new'); if( $terms ): ?>
      <ul>
        <?php foreach( $terms as $term ): ?>
            <li>                 
            <h2><?php echo esc_html( $term->name ); ?></h2>
            <p><?php echo esc_html( $term->description ); ?></p>
            <a>">View all '<?php echo esc_html( $term->name ); ?>' posts</a>
            </li>
        <?php endforeach; ?>
    </ul>
    <?php endif; ?>

    The only taxonomy property that is being returned is the link with <?php echo esc_url( get_term_link( $term ) ); ?>

    I have tried $term->slug; and that does not work either.

    What could I be missing here? No other name, description, slug anything is returned other than the link. Any help is greatly appreciated.

    I assume this needs to go into a Front-end issue but I apologize if this is in the wrong spot. My first post here.

  • Unread

    URL with Taxonomy & Custom Field

    Hi everyone, I created a custom post type called “library” and for a taxonomy, called “Bible Portion”. And inside the portion I added a custom field called “week” where I want to mark that this is the portion for this current week.

    Now I would like to provide a post view where always the posts of the current week are shown, and all I have to do is to update the category with its custom field.

    I already created a page where the category is filtered correctly.

    https://www.my-domain.com/author/?bible-portion

    Now my question is how can I filter the bible portion that has the custom field “week” filled with “yes”?

    Your help is much appreciated

    Yonatan

  • Unread

    Code snippets in ACF

    Hi there,

    I am using divi and the ACF plugin to create a template for a custom post type. In these posts I need to include unique Hubspot forms that come as code snippets. I have tried using the WYSIWYG field however it displays the code as plain text rather than displaying the form as intended.

    Does anyone have a fix for this that would allow me to create a custom field for the form code snippets that would allow for unique Hubspot forms on each post?

    Thanks

  • Solving

    Block validation bug with nested groups and conditional logic

    Hello,

    I would like to report a bug we ecountered this week. Since the 6.3.1 release, required fields that need a conditional logic are not being validated properly if this field is inside a group that is inside another group, example:

    • Group

      • Child Group

        • True/False Field
        • Field (required) – Shows if True/False is true

    If I add those fields to a block, and the true/false is set to false, meaning that the required field will not be displayed, the validation works fine and I can proceed to save the page, but if I load the page again, to edit for example, it will automatically throw a validation error, and I cannot save the page again, that’s because the required field that is displayed on the true condition is empty, but it should not be validating this field because the condition is set to false and the field should not be displayed.

    If this was brought up already before you can ignore the topic and link me to the main issue please.

  • Unread

    Is it possible to set up a User taxonomy using ACF Pro?

    Hi, I have a use case that requires us to attach an organisation to every WP user and it makes most sense (?) to add an Organisation taxonomy to the the User.

    I’ve searched the documentation but didn’t see anything like this and the forum has one thread, started back in 2015 with the latest response in 2017.

    So the question, is does ACF Pro have this functionality, and if not does anyone know of a way to achieve this?

    Any help is greatly appreciated.

    C.

  • Unread

    Flexible content on taxonomy page

    Hi,

    I am currently working on a woocommerce website and I have an issue on this :

    	
    	<?php
    
    		// Check value exists.
    		if( have_rows('contenu_flexible', $current_category->taxonomy.'_'.$current_category->term_id) ):
    			echo "ok";
    
    			// Loop through rows.
    			while ( have_rows('contenu_flexible', $current_category->taxonomy.'_'.$current_category->term_id) ) : the_row();
     ?>
    

    but I can’t even display the “ok”. And if I do a var dump avec the acf field it shows an array : array(11) {
    [0]=>
    string(28) “texte_pleine_largeur_de_page”

    So I do have data in this field I don’t know how i can manage to display everything I want

    Thank you !

  • Unread

    ACF Block as Widget: Can I hide the parent if my ACF block is empty?

    I have several ACF blocks that I use as widgets in my site’s sidebar. Several of these are simply WP_Query’s that list recent posts of a given content type. For example, artwork I have created in the last three months or posts from exactly one year ago today.

    Often these blocks will be empty, but WordPress still renders the containing <section> block as an empty tag:

    <section id="block-12" class="widget widget_block"></section>

    Is there a way to prevent WordPress from rendering this empty tag if the block is empty?

    For example, in my-acf-block.php, is there something I could put in the else statement of if ($posts->have_posts()) : that would tell the WordPress there’s nothing here to render?

  • Solving

    Rating Calculator

    Hello, everyone,
    I have my own post type called “Reviews”, where I always have a post with the name of the product type (let’s understand e.g. CABLE A). For this post, I use the repeater to fill in the individual user reviews from the questionnaire.

    For example
    – Pavel
    – Text ratings
    – Number of stars

    I then list these ratings from the repeater for the product in the slider, which is not a problem. However, in the same block I also have the “Overall Rating”, which should be a numerical average of all the “star counts”.

    So the calculation is e.g.
    – (5 + 5 + 4 + 3) / 4 = 4.25

    I then link the product to this rating (post) using the “RELATIONSHIP” field. When using the while function for the repeater, can I somehow store and calculate these ratings somewhere and then write them into the “Overall Rating”?

    How to do that?

    Thank you for your plugin

    Robert
    mybelka.cz

  • Unread

    ACF Blocks and Pagination

    How can I make an ACF block that has paginated posts work when used on a page? I’ve tried and get a 404 when I try any of the paginated urls (like /page/2/).

    Here’s a link to a Reddit post outlining the same issue: https://www.reddit.com/r/Wordpress/comments/198fw90/comment/l1q1noz/

  • Helping

    Is this possible with ACF Pro?

    I’ve been asked to develop an e-commerce (WooCommerce) site for a new client.

    The client is a fishmonger who plans to sell by specific weights of 250g, 500g, 1kg, 2.5kg, and 5kg. The price per weight will change as follows – 250g +10%, 500g +5%, 2.5kg -5%, and 5kg -10%. The price per weight discount/addition will need some flexibility, too. The client will need the option to amend these rates.

    A wide range of fresh fish will be sold, including (but not limited to) cod, herring, mackerel, trout, salmon, squid, and octopus.

    The wholesale cost of each fish type fluctuates daily, so the client will need to easily and quickly edit the ‘cost per kg’ unit for each fish type, which will, in turn, affect the product (variable) price in WooCommerce.

    ~ Options Page Idea ~ (prices editable by client)
    Cod (price per Kg) = $10
    Herring (price per Kg) = $7
    Mackerel (price per Kg) = $6
    Trout (price per Kg) = $11
    Salmon (price per Kg) = $18
    Squid (price per Kg) = $12
    Octopus (price per Kg) = $20

    ~ Product Variation Idea ~ (percentages editable by client on options page)
    Fish Family = COD
    250g = $2.50 + 10%
    500g = $5 + 5%
    1kg = $10
    2.5kg = $25 – 5%
    5kg = $50 – 10%

  • Unread

    Icon Picker field required $attachment_id

    Hi,

    I found a new bug for the Icon Picker field. In our theme we have a filter on the wp_get_attachment_image_url function.

    When no image is selected, the value of $field[‘value’][‘value’] is NULL on line 169 of class-acf-field-icon_picker.php

    										<?php
    											$img_url = wp_get_attachment_image_url( $field['value']['value'], 'thumbnail' );
    											// If the type is media_library, then we need to show the media library preview.
    										?>

    In our theme we have set $attachment_id as a required int. And therefor we get an critical error.

    Is this a bug on your end, or do we need to allow also NULL for $attachment_id?

  • Helping

    Use shortcode in textarea on options page in loop

    I have an option page where you can save an email body text to send out to customers. To make it personal I use shortcodes within the body text like this:

    Dear [yl_first_name],

    How are you today?

    Kind regards,
    Team X

    ————————-

    The email sends out with WordPress cronjob and all works fine except for 1 thing:

    Because ‘officially’ the FIRST NAME is NOT called in the below WordPress loop >> Its the shortcode that is called (via the option page) in the loop…

    I always get the same name value (latest post in line).

    Here’s my EMAIL SEND code:

    // Follow-up e-mail met reviewverzoek
    function yl_follow_up_email_review_function() {

    $review_days_after = get_field(‘booking_settings_review_delay’, ‘booking_settings’);
    $review_url = get_field(‘booking_settings_review_url’, ‘booking_settings’);

    if ($review_days_after && $review_url) {

    $bookings = array(
    ‘posts_per_page’ => -1,
    ‘post_type’ => ‘booking’,
    ‘meta_query’ => array(
    ‘relation’ => ‘AND’,
    array(
    ‘key’ => ‘booking_status’,
    ‘value’ => array(‘confirmed’, ‘changed’),
    ‘compare’ => ‘IN’,
    ),
    array(
    ‘key’ => ‘booking_send_mail’,
    ‘value’ => ‘ja’,
    ‘compare’ => ‘=’,
    ),
    ),
    );

    // De Query
    $query = new WP_Query($bookings);

    // De Loop
    if ($query->have_posts()) {
    while ($query->have_posts()) {
    $query->the_post();

    // Controleer of de poststatus ‘publish’ is
    if (get_post_status() == ‘publish’) {

    // Verkrijg aangepaste velden van de huidige boeking
    $to = get_field(‘booking_email’);

    // Zorg ervoor dat deze velden bestaan in je booking_settings
    $booking_settings_id = ‘booking_settings’; // De ID van de booking settings post

    $sender_name = get_field(‘booking_email_from_name’, $booking_settings_id);
    $sender_email = get_field(‘booking_email_from_email_address’, $booking_settings_id);
    $subject = get_field(‘booking_email_subject_review’, $booking_settings_id);
    $message = get_field(‘booking_email_message_review’, $booking_settings_id); // the above body text with the shortcode inside

    $headers = array(
    ‘From: ‘ . $sender_name . ‘ <‘ . $sender_email . ‘>’,
    ‘Content-Type: text/html; charset=UTF-8’
    );

    // Verzend de e-mail en log eventuele fouten
    if (wp_mail($to, $subject, $message, $headers)) {
    error_log(“Email successfully sent to $to for booking ID: ” . get_the_ID());
    } else {
    error_log(“Failed to send email to $to for booking ID: ” . get_the_ID());
    }

    // Update met nieuwe waarde
    update_field(‘booking_status’, ‘completed’);

    // Pauzeer 10 seconden voordat de volgende e-mail wordt verzonden
    sleep(10);
    }

    // Reset de postdata
    wp_reset_postdata();
    }
    }
    }
    }
    add_action(‘yl_follow_up_email_review’, ‘yl_follow_up_email_review_function’);

    The Shortcode code:

    // Get ACF ‘First name’ values via shortcode
    function yl_booking_first_name_shortcode() {
    global $post; // Haal de globale $post variabele op
    return get_field(‘booking_first_name’, $post->ID);
    }
    add_shortcode(‘yl_booking_first_name’,’yl_booking_first_name_shortcode’);

    —————-

    So how can I change the code so the correct name in each email is showing?

  • Unread

    Two separate Field Groups for the same block based on Page Type?

    I’m trying to have two separate Field Groups for a “hero” block based on whether the block resides on the front page or not. When I try to limit the Location Rules like so:

    Show this field group if Block is equal to Hero
    and
    Page Type is equal to Front Page

    I get the response:

    This block contains no editable fields. Assign a field group to add fields to this block.

    Is it possible to limit the location rules in this way?

  • Solved

    Cronjob acts only on last post in custom post loop

    I have created this custom code to send out ‘REVIEW REQUEST EMAILS’ via a WordPress cronjob. The code works and an email is sent out, but ALWAYS ONLY FOR THE LAST POST.

    So, even when older posts still match the criteria it will NOT send out any email for these posts.

    How can I change this behavior so older posts won’t be ignored and emails for these posts (matching the criteria) will also be send out?

    Thanks.

    `
    // Follow up e-mail met review verzoek
    function yl_follow_up_email_review_function() {

    $review_days_after = get_field(‘booking_settings_review_delay’, ‘booking_settings’);
    $review_url = get_field(‘booking_settings_review_url’, ‘booking_settings’);

    if ($review_days_after && $review_url) {

    $bookings = array(
    ‘posts_per_page’ => -1,
    ‘post_type’ => ‘booking’,
    ‘meta_query’ => array(
    ‘relation’ => ‘AND’,
    array(
    ‘key’ => ‘booking_status’,
    ‘value’ => array(‘confirmed’, ‘changed’),
    ‘compare’ => ‘IN’,
    ),
    array(
    ‘key’ => ‘booking_send_mail’,
    ‘value’ => ‘ja’,
    ‘compare’ => ‘=’,
    ),
    ),
    );

    // The Query
    $query = new WP_Query( $bookings );

    // The Loop
    if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
    $query->the_post();

    // Verkrijg aangepaste velden van de huidige booking
    $send_email = get_field(‘booking_send_mail’);
    $booking_status = get_field(‘booking_status’);
    $to = get_field(‘booking_email’);

    // Zorg ervoor dat deze velden bestaan in je booking_settings
    $sender_name = get_field(‘booking_email_from_name’, ‘booking_settings’);
    $sender_email = get_field(‘booking_email_from_email_address’, ‘booking_settings’);
    $subject = get_field(‘booking_email_subject_review’, ‘booking_settings’);
    $message = get_field(‘booking_email_message_review’, ‘booking_settings’);

    $headers = array(
    ‘From: ‘ . $sender_name . ‘ <‘ . $sender_email . ‘>’,
    ‘Content-Type: text/html; charset=UTF-8’
    );

    // Verzend de e-mail en log eventuele fouten
    if (wp_mail($to, $subject, $message, $headers)) {
    error_log(“Email successfully sent to $to for booking ID: ” . $query->post->ID);
    } else {
    error_log(“Failed to send email to $to for booking ID: ” . $query->post->ID);
    }

    // Update with new value.
    update_field(‘booking_status’, ‘completed’);

    }
    }

    // Reset postdata
    wp_reset_postdata();

    }
    }
    add_action(‘yl_follow_up_email_review’, ‘yl_follow_up_email_review_function’);
    `

  • Unread

    Cronjob only acts on last post in loop

    I have a created a custom code for sending out ‘Review Request emails’ via a WordPress cronjob.

    The code works fine but it always ONLY acts on the LAST POST. So even though older posts still match the criteria, it doesn’t send out emails for them.

    Any idea what I can do to change this behavior so the system will send out multiple emails (if the criteria matches)?


    // Follow up e-mail met review verzoek
    function yl_follow_up_email_review_function() {

    $review_days_after = get_field(‘booking_settings_review_delay’, ‘booking_settings’);
    $review_url = get_field(‘booking_settings_review_url’, ‘booking_settings’);

    if ($review_days_after && $review_url) {

    $bookings = array(
    ‘posts_per_page’ => -1,
    ‘post_type’ => ‘booking’,
    ‘meta_query’ => array(
    ‘relation’ => ‘AND’,
    array(
    ‘key’ => ‘booking_status’,
    ‘value’ => array(‘confirmed’, ‘changed’),
    ‘compare’ => ‘IN’,
    ),
    array(
    ‘key’ => ‘booking_send_mail’,
    ‘value’ => ‘ja’,
    ‘compare’ => ‘=’,
    ),
    ),
    );

    // The Query
    $query = new WP_Query( $bookings );

    // The Loop
    if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
    $query->the_post();

    // Verkrijg aangepaste velden van de huidige booking
    $send_email = get_field(‘booking_send_mail’);
    $booking_status = get_field(‘booking_status’);
    $to = get_field(‘booking_email’);

    // Zorg ervoor dat deze velden bestaan in je booking_settings`
    $sender_name = get_field('booking_email_from_name', 'booking_settings');
    $sender_email = get_field('booking_email_from_email_address', 'booking_settings');
    $subject = get_field('booking_email_subject_review', 'booking_settings');
    $message = get_field('booking_email_message_review', 'booking_settings');

    $headers = array(
    'From: ' . $sender_name . ' <' . $sender_email . '>',
    'Content-Type: text/html; charset=UTF-8'
    );

    // Verzend de e-mail en log eventuele fouten
    if (wp_mail($to, $subject, $message, $headers)) {
    error_log("Email successfully sent to $to for booking ID: " . $query->post->ID);
    } else {
    error_log("Failed to send email to $to for booking ID: " . $query->post->ID);
    }

    // Update with new value.
    update_field('booking_status', 'completed');

    }
    }

    // Reset postdata
    wp_reset_postdata();

    }
    }
    add_action('yl_follow_up_email_review', 'yl_follow_up_email_review_function');

  • Solved

    Filtering posts between two dates, based on selected month, with a meta query

    I have some filters on my post archive and one of them is a month dropdown. The post type has 2 custom fields, one for start date and one for end date. I am trying to add a meta query to retrieve posts where the selected month falls between these two dates.

    IE if a post has a start_date of 20240502 and the end_date is 20240815, for example, it would always show up if the user selected any month between May(05) and August(08).

    I tried modifying a response from another post I found:

    $sel_month = '05';
    $meta_query[] = array(
        'relation' => 'OR',
        array(
            'key'      => 'start_date',
            'compare'  => 'REGEXP',
            'value'    => '[0-9]{4}' . $sel_month . '[0-9]{2}',
        ),
        array(
            'key'      => 'end_date',
            'compare'  => 'REGEXP',
            'value'    => '[0-9]{4}' . $sel_month . '[0-9]{2}',
        )
    );

    But with this, it will only show the post if the start_date month is selected or the end_date month is selected but not any of the months between.

    Any ideas how I can modify this query to show all posts where the selected month falls between the start_date and end_date of the post?

  • Unread

    Pages with ACF Blocks not displayed in Search Results

    Hi everyone.

    Recently I have been building ACF blocks with WP_Query in order to display custom post type information (i.e, the_title(), the_content(), the_post_thumbnail(), etc). However, pages that contain my ACF blocks do not show up in WordPress search results. I am guessing that this is a limitation with default WordPress search capability. How do others handle this issue?

    Any suggestions are greatly appreciated – thanks.

  • Unread

    ACF’s checkbox module doesn’t work with Divi.

    Hello !
    I’m using ACF dynamic fields to display content on my product pages. I need to use the ‘Checkbox’ module to insert checkboxes on my pages. The problem is that when I generate these checkboxes and check them in the backend so they’re also checked on the frontend, my site stops displaying anything and shows me this error

    “Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/plugin-compat/advanced-custom-fields.php:269 Stack trace: #0 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/plugin-compat/advanced-custom-fields.php(98): ET_Builder_Plugin_Compat_Advanced_Custom_Fields->format_field_value(Array, Array) #1 /Applications/MAMP/site/NordSudCaravaning/wp-includes/class-wp-hook.php(324): ET_Builder_Plugin_Compat_Advanced_Custom_Fields->maybe_filter_dynamic_content_meta_value(Array, ‘case_test’, 1127) #2 /Applications/MAMP/site/NordSudCaravaning/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #3 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/feature/dynamic-content.php(1734): apply_filters(‘et_builder_dyna…’, Array, ‘case_test’, 1127) #4 /Applications/MAMP/site/NordSudCaravaning/wp-includes/class-wp-hook.php(324): et_builder_filter_resolve_custom_field_dynamic_content(Array, ‘custom_meta_cas…’, Array, 1127, ‘display’, Array) #5 /Applications/MAMP/site/NordSudCaravaning/wp-includes/plugin.php(205): WP_Hook->apply_filters(”, Array) #6 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/feature/dynamic-content.php(935): apply_filters(‘et_builder_reso…’, ”, ‘custom_meta_cas…’, Array, 1127, ‘display’, Array) #7 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/class-et-builder-value.php(93): et_builder_resolve_dynamic_content(‘custom_meta_cas…’, Array, 1127, ‘display’) #8 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(21802): ET_Builder_Value->resolve(1127) #9 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(3077): ET_Builder_Element->_resolve_value(1127, ‘content’, ‘@ET-DC@eyJkeW5h…’, Array, NULL) #10 /Applications/MAMP/site/NordSudCaravaning/wp-includes/shortcodes.php(433): ET_Builder_Element->_render(Array, ‘@ET-DC@eyJkeW5h…’, ‘et_pb_text’) #11 [internal function]: do_shortcode_tag(Array) #12 /Applications/MAMP/site/NordSudCaravaning/wp-includes/shortcodes.php(273): preg_replace_callback(‘/\\[(\\[?)(et_pb_…’, ‘do_shortcode_ta…’, ‘[et_pb_text _bu…’) #13 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/main-structure-elements.php(3784): do_shortcode(‘[et_pb_text _bu…’) #14 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(3433): ET_Builder_Column->render(Array, ‘[et_pb_text _bu…’, ‘et_pb_column’, ”, ”, ”, ”, ”) #15 /Applications/MAMP/site/NordSudCaravaning/wp-includes/shortcodes.php(433): ET_Builder_Element->_render(Array, ‘[et_pb_text _bu…’, ‘et_pb_column’) #16 [internal function]: do_shortcode_tag(Array) #17 /Applications/MAMP/site/NordSudCaravaning/wp-includes/shortcodes.php(273): preg_replace_callback(‘/\\[(\\[?)(et_pb_…’, ‘do_shortcode_ta…’, ‘[et_pb_column _…’) #18 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/main-structure-elements.php(2274): do_shortcode(‘[et_pb_column _…’) #19 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(3433): ET_Builder_Row->render(Array, ‘[et_pb_column _…’, ‘et_pb_row’, ”, ”, ”, ”, ”) #20 /Applications/MAMP/site/NordSudCaravaning/wp-includes/shortcodes.php(433): ET_Builder_Element->_render(Array, ‘[et_pb_column _…’, ‘et_pb_row’) #21 [internal function]: do_shortcode_tag(Array) #22 /Applications/MAMP/site/NordSudCaravaning/wp-includes/shortcodes.php(273): preg_replace_callback(‘/\\[(\\[?)(et_pb_…’, ‘do_shortcode_ta…’, ‘[et_pb_row colu…’) #23 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/main-structure-elements.php(1606): do_shortcode(‘[et_pb_row colu…’) #24 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(3433): ET_Builder_Section->render(Array, ‘[et_pb_row colu…’, ‘et_pb_section’, ”, ”, ”, ”, ”) #25 /Applications/MAMP/site/NordSudCaravaning/wp-includes/shortcodes.php(433): ET_Builder_Element->_render(Array, ‘[et_pb_row colu…’, ‘et_pb_section’) #26 [internal function]: do_shortcode_tag(Array) #27 /Applications/MAMP/site/NordSudCaravaning/wp-includes/shortcodes.php(273): preg_replace_callback(‘/\\[(\\[?)(et_pb_…’, ‘do_shortcode_ta…’, ‘<div class=”et-…’) #28 /Applications/MAMP/site/NordSudCaravaning/wp-includes/class-wp-hook.php(324): do_shortcode(‘<div class=”et-…’) #29 /Applications/MAMP/site/NordSudCaravaning/wp-includes/plugin.php(205): WP_Hook->apply_filters(‘<div class=”et-…’, Array) #30 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/core.php(46): apply_filters(‘et_builder_rend…’, ‘[et_pb_section …’) #31 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/frontend-builder/theme-builder/frontend.php(347): et_builder_render_layout(‘[et_pb_section …’) #32 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/frontend-builder/theme-builder/frontend.php(506): et_theme_builder_frontend_render_layout(‘et_body_layout’, 723) #33 /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/frontend-builder/theme-builder/frontend-body-template.php(7): et_theme_builder_frontend_render_body(723, true, 731) #34 /Applications/MAMP/site/NordSudCaravaning/wp-includes/template-loader.php(106): include(‘/Applications/M…’) #35 /Applications/MAMP/site/NordSudCaravaning/wp-blog-header.php(19): require_once(‘/Applications/M…’) #36 /Applications/MAMP/site/NordSudCaravaning/index.php(17): require(‘/Applications/M…’) #37 {main} thrown in /Applications/MAMP/site/NordSudCaravaning/wp-content/themes/Divi/includes/builder/plugin-compat/advanced-custom-fields.php on line 269″

    What could be the source of the problem? Is it because of the Divi theme? Because the other ACF modules work fine, the only issue is with the checkboxes. Has anyone experienced this kind of error before?
    Thank you for your responses.

  • Unread

    No taxonomies on CPTs, even when enabled

    I’ve got a CPT called ‘Locations’ defined via ACF. Under Taxonomies on the Edit Post Type screen I’ve enabled tags but the Tags metabox doesn’t show up on the Edit Post page, under quick edit or in the menu under Locations. This worked at one point because I was adding tags to this post type several weeks/months ago, but it seems to have stopped working via a recent ACF or WordPress update and I’ve only just noticed.

    I tried creating a brand new CPT and enabling Tags there and they don’t show up on that one either, so it’s not a problem specific to this post type.

    Here’s the post type registration (obtained via Tools > Export PHP). As you can see, post_tag is included there. I also tried enabling Categories and these don’t appear either.

    
    add_action( 'init', function() {
    	register_post_type( 'location', array(
    	'labels' => array(
    		'name' => 'Locations',
    		'singular_name' => 'Location',
    		'menu_name' => 'Locations',
    		'all_items' => 'All Locations',
    		'edit_item' => 'Edit Location',
    		'view_item' => 'View Location',
    		'view_items' => 'View Locations',
    		'add_new_item' => 'Add New Location',
    		'add_new' => 'Add New Location',
    		'new_item' => 'New Location',
    		'parent_item_colon' => 'Parent Location:',
    		'search_items' => 'Search Locations',
    		'not_found' => 'No locations found',
    		'not_found_in_trash' => 'No locations found in Trash',
    		'archives' => 'Location Archives',
    		'attributes' => 'Location Attributes',
    		'insert_into_item' => 'Insert into location',
    		'uploaded_to_this_item' => 'Uploaded to this location',
    		'filter_items_list' => 'Filter locations list',
    		'filter_by_date' => 'Filter locations by date',
    		'items_list_navigation' => 'Locations list navigation',
    		'items_list' => 'Locations list',
    		'item_published' => 'Location published.',
    		'item_published_privately' => 'Location published privately.',
    		'item_reverted_to_draft' => 'Location reverted to draft.',
    		'item_scheduled' => 'Location scheduled.',
    		'item_updated' => 'Location updated.',
    		'item_link' => 'Location Link',
    		'item_link_description' => 'A link to a location.',
    	),
    	'public' => true,
    	'show_in_rest' => true,
    	'menu_position' => 2,
    	'menu_icon' => 'dashicons-location',
    	'supports' => array(
    		0 => 'title',
    		1 => 'revisions',
    		2 => 'thumbnail',
    		3 => 'custom-fields',
    	),
    	'taxonomies' => array(
    		0 => 'post_tag',
    	),
    	'has_archive' => 'locations',
    	'rewrite' => array(
    		'slug' => 'messages',
    		'with_front' => false,
    		'feeds' => false,
    	),
    	'delete_with_user' => false,
    ) );
    } );
    
    add_filter( 'enter_title_here', function( $default, $post ) {
    	switch ( $post->post_type ) {
    		case 'location':
    			return 'Location name';
    	}
    
    	return $default;
    }, 10, 2 );
    
  • Helping

    Como desinstalar ACF correctamente

    Buenas tardes, he intentado desinstalar ACF pero al momento de hacerlo rompe mi web por completo, hay alguna manera de desinstalarlo sin que rompa mi web?
    https://imgur.com/a/k96Z8FW

  • Unread

    switch_to_blog, options page, Repeater field

    Hello,

    I am creating this discussion and topic as there is an annoying piece of a puzzle that I cannot seem to solve at this moment.

    It has to do with Multisite and ACF Repeater Fields.

    If there are repeater fields in the options pages or maybe in posts too, trying to switch_to_blog into the main blog doesn’t return any arrays or values but rather just a number that seems to just give the number of rows.

    So this:

    switch_to_blog( 1 );
    
    $custom_styles = get_field('custom_styles', 'option');
    var_dump($custom_styles);
    
    restore_current_blog();

    Gives:

    array(3) { [0]=> array(3) { ["custom_style_name"]=> string(4) "Blin" ["custom_style_class"]=> string(4) "blin" ["custom_style_css"]=> string(37) "background-color: #fff; color: #000;" } [1]=> array(3) { ["custom_style_name"]=> string(4) "Blin" ["custom_style_class"]=> string(4) "Blin" ["custom_style_css"]=> string(37) "background-color: #fff; color: #000;" } [2]=> array(3) { ["custom_style_name"]=> string(4) "Blin" ["custom_style_class"]=> string(4) "Blin" ["custom_style_css"]=> string(37) "background-color: #fff; color: #000;" } }

    When on the main blog aka id 1.

    And on a subsite the value given is:

    string(1) "3"

    Any other field that is just a single piece of info does not have a problem. So Group has the same thing.

    The ACF Field exists on both sites and the key is the same.

    Thank you. 🙏🏼

  • Unread

    oEmbed returning Video Link instead of the Player.

    The code snippet from the ACF documentation returns the URL of the media I’m trying to embed instead of the iframe/video player itself.

    <div class="embed-container">
        <?php the_field('video_embed'); ?>
    </div>
    <style>
        .embed-container { 
            position: relative; 
            padding-bottom: 56.25%;
            overflow: hidden;
            max-width: 100%;
            height: auto;
        } 
        .embed-container iframe,
        .embed-container object,
        .embed-container embed { 
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
    </style>
    

    Is this normal?

    I know that the correct field is being returned with <?php the_field('video_embed'); ?> would love to get some help on how to return the video player/iframe.

    I’ve also tried going the other route with PHP and it’s the same result.

    <?php
    
    // Load value.
    $iframe = get_field('oembed');
    // Use preg_match to find iframe src.
    preg_match('/src="(.+?)"/', $iframe, $matches);
    $src = $matches[1];
    // Add extra parameters to src and replace HTML.
    $params = array(
        'controls'  => 0,
        'hd'        => 1,
        'autohide'  => 1
    );
    $new_src = add_query_arg($params, $src);
    $iframe = str_replace($src, $new_src, $iframe);
    // Add extra attributes to iframe HTML.
    $attributes = 'frameborder="0"';
    $iframe = str_replace('></iframe>', ' ' . $attributes . '></iframe>', $iframe);
    // Display customized HTML.
    echo $iframe;
    ?>

    Would appreciate anyone’s help! And even better if the solution is more like that first snippet, using HTML.

    Many thanks!

Viewing 25 results - 176 through 200 (of 21,345 total)