Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

topic

  • Solving

    How to create a slide gallery block?

    Hi to all,
    I need to create a slide gallery from a Gallery field.
    I have tried to use these two guides:
    The first shows how to create a testimonial block: https://www.advancedcustomfields.com/resources/create-your-first-acf-block/
    The second shows how to display the slider from the gallery custom field:
    https://www.advancedcustomfields.com/resources/gallery/#display-images-in-a-slider

    Then, in my child theme I created the blocks/acf-gallery folders, and inside it I uploaded the block.json and acf-gallery.php files.

    In functions.php I have added this code:

    
    function gnm_acf_gallery_block() {
        /**
         * We register our block's with WordPress's handy
         * register_block_type();
         *
         * @link https://developer.wordpress.org/reference/functions/register_block_type/
         */
        register_block_type( __DIR__ . '/blocks/acf-gallery' );
    }
    // Here we call our tt3child_register_acf_block() function on init.
    add_action( 'init', 'gnm_acf_gallery_block' );
    

    The block.json code is:

    
    {
        "name": "acf/gallery",
        "title": "ACF Gallery",
        "description": "A custom gallery block that uses ACF fields.",
        "category": "formatting",
        "icon": "admin-comments",
        "keywords": ["gallery", "quote"],
        "acf": {
            "mode": "preview",
            "renderTemplate": "acf-gallery.php"
        },
        "supports": {
            "anchor": true
        }
    }
    

    In the acf-gallery.php I have added the following code:

    
    <?php 
    $images = get_field('galleria_casasi');
    if( $images ): ?>
        <div id="slider" class="flexslider">
            <ul class="slides">
                <?php foreach( $images as $image ): ?>
                    <li>
                        <img />" alt="<?php echo esc_attr($image['alt']); ?>" />
                        <p><?php echo esc_html($image['caption']); ?></p>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
        <div id="carousel" class="flexslider">
            <ul class="slides">
                <?php foreach( $images as $image ): ?>
                    <li>
                        <img />" alt="Thumbnail of <?php echo esc_url($image['alt']); ?>" />
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
    <?php endif;>
    

    Into the <head> I have added the following script:

    
    <link rel="stylesheet" href="flexslider.css" type="text/css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    <script src="jquery.flexslider.js"></script>
    <script type="text/javascript" charset="utf-8">
      $(window).load(function() {
        $('.flexslider').flexslider();
      });
    </script>
    

    Now, inside the blocks list I can find the Gallery Block, but it doesn’t works fine. It doesn’t display the slider gallery.

    What is wrong and what should I do to solve the issue?

    Thanks

  • Helping

    Elementor Query by / Category. Here I cannot select a dynamic tag

    Hello team,

    I suspect it is an elementor problem.

    In elementor I can only find the products
    Query by / Specifics IDs — select a dynamic tag e.g. ACF its ok
    https://imgur.com/Csat2kc

    However, this function does not exist.
    When I:
    Query by / Category.
    Here I cannot select a dynamic tag
    https://imgur.com/FlkWvmU

    Is this an error, or does this function not exist?

    Thanks for your help.

  • Helping

    Trouble Displaying Post-Specific Field Groups

    Hello everyone,

    I’m facing an issue with displaying a field group within a custom post type I’ve created, and I’d appreciate some assistance.

    Here’s what I’ve done so far:

    1. I created a custom post type called “Products.”
    2. Within “Products,” I’ve added three products – X, Y, and Z.
    3. I created a new field group named “X Product Fields” with the intention of showing these fields exclusively in the “X” product.

    To make this happen, I set the location rules on the field group as follows: “Show this field group if Post is equal to X.” (See attached)

    However, when I open the “X” product, I can’t see the fields (see attached). Surprisingly, if I change the location rules to “Show this field group if Post Type is equal to Product,” the field group appears. But this isn’t what I want. I need post-specific field groups.

    Any help or guidance would be greatly appreciated. Thank you!

    https://ibb.co/Z1PfMkW
    https://ibb.co/rxHq7bq

  • Helping

    Strategy for Custom Image Sizes

    I’m working on a site with a large image library. This site has a custom frontpage that has a banner image with a specific size (which does not match any of the built-in WordPress image sizes). Currently, users upload banner images via an ACF field, and the theme grabs the full-size upload and just forces it to the height/width requirements via CSS, which results in very large images loading and then being resized.

    I would like to automatically resize the banner image on upload to the exact size actually we actually need.

    The main method of doing this that I can find online is to use the add_image_size() function, whose documentation is available here. After that image size is created, a plugin like Regenerate Thumbnails can resize all existing images to make sure that the custom size is now available.

    The problem is that “all existing images” part – the site has literally thousands of images. It would be costly in terms of time, CPU %, and ultimately storage to have a new banner sized version of every single image on the server. Of course, I can always skip the “resize existing images” step and only resize images uploaded from this point forward, but it still leads to the problem that we need one banner image while there are dozens of images uploaded weekly that would not need this size.

    I’m wondering if there are any better strategies for this? I’m hoping there’s some way to create an image of specific height/width when (and only when) that image is uploaded via a specific ACF image field. Any ideas?

  • Solving

    Is this the right way?

    I need to know if this is the right way of doing this after reading something about html_esc.

    I have a custom post type for the Event and it has a Google Maps embed iframe on the event template.

    <iframe
    width=”450″
    height=”250″
    frameborder=”0″ style=”border:0″
    referrerpolicy=”no-referrer-when-downgrade”
    src=”https://www.google.com/maps/embed/v1/MAP_MODE?key=YOUR_API_KEY&PARAMETERS&#8221;
    allowfullscreen>
    </iframe>

    is it OK to code it like this. My fields name are google_maps_api_key which I set on an options page up for and venue_name. It works fine but I’m new at this so I’m unsure.

    <iframe
    width=”450″
    height=”250″
    frameborder=”0″ style=”border:0″
    referrerpolicy=”no-referrer-when-downgrade”
    src=”https://www.google.com/maps/embed/v1/MAP_MODE?key=&lt;?php echo get_field(‘google_maps_api_key’, ‘option’); ?>&q=<?php echo get_field(‘venue_name’); ?>”
    allowfullscreen>
    </iframe>

    I would be grateful for any advice.

  • Unread

    Repeater field with multiple predefined templates and values

    I have created a Post type for “Device” on my website by ACF plugin. I want to make a fully automatic part to display device specifications using Elementor and Repeater field, but it requires coding that I don’t know much about. I have shown the idea of displaying the specifications in the attached photo; To make something I think like this:
    1. Create a repeater field for all “device” post types.
    2. In that repeater field, create a select field so that I can choose the type of information that I want to display.

    As you can see in the photo, I have displayed 3 templates, each of which has a different number of variable and static values. The static values are such that I select it in the select field that I created earlier and then write the variable values that are different for each device.

    So far it is correct and I can even display the values in elementor, but I don’t want to write all the static instances for each device, for example you can see in the picture that each template has a “description”, all of them in all devices. are one

    What I want is this: I want to create a repeater in acf, which in the first step creates a select field (this select field should receive its choices from the options page or any other method in which new values can be added later slow.). Then ACF should recognize how many variables I should enter (for example, in the select field, I have selected the volume option, ACF should give me 3 text fields to enter those variables. Or, for example, if I choose CEO, it will give me a give a text field and a media field.)

    Image

    Also, i think this is a little close to what i’m looking for, but i couldn’t understand:
    https://support.advancedcustomfields.com/forums/topic/dynamically-populating-repeater-fields-with-default-values/

  • Helping

    add class to woocommerce single product template gallery thumbnails if media …

    the goal: add class to woocommerce single product template gallery thumbnails if media attachment ACF field toggled (true/false)

    i have the following custom field (quick_ship):

    i’ve added this in functions but not working at the moment:

    <?php

    $image = get_field('quick_ship');
    $size = 'full'; // (thumbnail, medium, large, full or custom size)
    if( $image ) {
    echo wp_get_attachment_image( $image, $size, array ('class' => 'quick-ship' ) );
    }

    thanks for any help.

  • Helping

    Help needed with displaying images on the front-end.

    Hi there.
    I am new to ACF, but after following the docs, my images are showing as broken images.
    I have posted a screenshot and supply code below.
    Any help much appreciated.

    As you can see in screenshot: Link

    here is my code.

    
    <?php
    /**
     * The template for displaying all pages
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site may use a
     * different template.
     *
     * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
     *
     * @package base
     */
    
     
    
    get_header();
    ?>
    
    	<main id="primary" class="site-main">
    
    		<?php
    		while ( have_posts() ) :
    			the_post();
    			
    			
    			?>
    			<img />" />
    				<?php
    			
    			
    			
    			
    
    			get_template_part( 'template-parts/content', 'page' );
    
    			// If comments are open or we have at least one comment, load up the comment template.
    			if ( comments_open() || get_comments_number() ) :
    				comments_template();
    			endif;
    
    		endwhile; // End of the loop.
    		?>
    
    	</main><!-- #main -->
    
    <?php
    get_sidebar();
    get_footer();
    

    please help 🙂
    Thank you.

  • Unread

    Dyanmically customize acf select2 field

    In the ACF user field (select2) I want to hide removing choice icon (x) except specific item that is current user, like the below image.

    Or, I want to add username, or user-id as CSS into selected item

  • Solving

    Only show my posts if the date picker date is still in the future or today

    I would like to display only events in the future or those taking place on the same day. All posts whose date picker start_event is older than today’s date should not be displayed, but I can’t do it…

          <?php $loop = new WP_Query( array( 'post_type' => 'evenement', 'posts_per_page' => 10 ) ); ?>
          <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
      
              <a href="<?php echo get_permalink() ?>">
                <div class="image">
                  <?php echo the_post_thumbnail(); ?>
                </div>
                <div class="description">
                  <div class="dates">
                      <?php echo get_field('start_event') ?> à <?php echo get_field('hour_start_event') ?>
                  </div>
                  <div class="nom">
                    <?php echo the_title(); ?>
                  </div>
                </div>
              </a>
      
          <?php endwhile; ?>
  • Solved

    Field loading already disabled

    I have a select field that is getting disabled .. mysteriously. Which is to say, I can’t figure how it’s happening. I put a debug output in the load_field filter for that field, and the “disabled” property is already true. I’m not sure when this started happening, as it’s been some months since anyone has needed to do anyhting that required the field to be enabled (ie, I can’t point to a recent plugin update as the potential culprit). There is one spot in the code where the field gets disabled, but it’s in that same load_field filter, and commenting out the disablement doesn’t change the outcome.

    Is there a filter earlier in the page lifecycle than load_field? I’m trying to figure out when it’s happening.

  • Solved

    Request: Mini WYSIWYG / Rich Text Editor Field Type

    Hi, I would really like a field type that is somewhere between a textarea field and a full WYSIWYG field.

    It would let you control the number lines like the textarea field, but it would have a very simple set of tools at the top to let you make words bold or italic, add links, or turn text into lists, without the client needing to add HTML themselves.

    Good examples of this are the Rich Text module within HubSpot and even the very text editor I am using to type this forum post.

    It would also be nice if you could customise what WYSIWYG elements are available to a user, so you could add things like font colour or size but remove the option to add list items or links.

    This would be useful for things like headings where a client user might need to make a specific word bold, but you don’t want them to rely on adding HTML to a text field, and the full WYSIWYG field just takes up too much space on the backend for something that is usually only a handful of words.

  • Unread

    ACF-Block (Relationship) passing through IDs to Query Loop Block?

    I want to use the Relationship Field to build a custom query. Is it possible to somehow pass the IDs to a nested Query Loop Block?

    Maybe by using Block Context (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-context/) and a Query Loop Variation to fetch the ID’s. Is something like that possible?

    Or is there an other way to do something like that?

    THX!

  • Helping

    get_posts by ACF Select field with labels

    I’m trying to query posts by a few select field’s labels. However, my query doesn’t seem to working. Am I approaching this correctly?

    function hide_cotw_heading(){
    	$title = get_the_title();
    	$args = array(
    		'cat' => 9,
    		'meta_query'    => array(
    			'relation'      => 'OR',
    			array(
    				'meta_key'       => 'author_1',
    				'meta_value'     => $title
    			),
    			array(
    				'meta_key'       => 'author_2',
    				'meta_value'     => $title
    			)
    		)
    	  );
    	  
    	  $latest_posts = get_posts( $args );
    	  if($latest_posts){
    		return 'Has posts';
    	  } else{
    		return 'No posts';
    	  }
    }
  • Solving

    Get all repeater fields outside the loop, but grouped?

    I was hoping someone could point me in a direction, as my searches are bringing up things that are not applicable. My posts keep getting marked as sp@m, so excuse my clumsy censoring. I’m not sure what’s tripping it up.

    I have a CPT, “B00ks”. Within that, there is a repeater field for “Editions”. Within that, there is a select dropdown to choose a “Type”, as well as an image field for the “Cover”, and a nested repeater for links to buy them. The structure looks like below:

    B00ks
    ---Editions (Repeater)
    ------Type (Select/Taxonomy)
    ------Cover (Image)
    ------Purchase Links (Repeater)
    -----------Link Name (Text)
    -----------URL (URL)

    I’ve gotten all this to show up on the single-b00ks page in a super spiffy way, and I’m jazzed! I’m now looking to build an “Editions” page which should show all editions of all b00ks, grouped by “Type”. This way, all audiob00ks will appear in a row, and then all paperbacks, and then all hardbacks, so and so forth.

    Since this will be on its own page, it’ll be outside of the CPT loop. I’m not quite sure where to start with both querying the posts, plucking out ONLY the special editions, and then grouping them by tax (if applicable, as some don’t have a “Type”).

    If anyone could point me in a direction, I’d really appreciate it!

  • Helping

    Get ancestor blocks

    I have created a custom ACF block with a block.json configuration. This block could either be used as a top level component in a post or page, or inside a regular WP query loop block. The block hierarchy would then be:

    Query Loop -> Post Template -> MyCustom Block

    In the render template I want the check if the block is currently used as a child inside a query loop block or not. Is that somehow possible?

    Maybe someone knows a good solution.

  • Solving

    Check for a value in a custom query

    Hi all,
    I have a custom query to show people working is specific divisions (label) in an organisation.
    I want to display the specific division’s name before the cards of the people are displayed.
    Currently I have this wp_query that filters out the division and shows the people in alphabetic order based on their last name. All people are displayed one after the other until the loop ends. What I am looking for is a way to get the division name and show the people, and then the second division and show the people working there etc.
    There are 7 divisions in total.
    My working code so far for the custom wp_query:

    
    $all_query = new WP_Query(array(
    	'post_type'	    => 'collegas',
    	'posts_per_page'    => -1,
    	'meta_query' 		=> array (
    		'relation' 	=> 'AND',
    		'label' 	=> array (
    			'key' 	=> 'medewerker_werkzaam_bij',
    		),
    		'persoon' 	=> array (
    			'key' 	=> 'medewerker_achternaam',
    		),
    	),
    	'orderby'			=> array (
    			'label' 	=> 'ASC',
    			'persoon'	=> 'ASC',
    	)
    ));
    

    As you can see, I am ordering by division (‘label’) and then by lastname (‘persoon’). This works great.
    But how can I check if the name (or value) for the division changes so I can add a heading like <div class=”divisione-heading”><?php ?????? ?></div> before I show the people working there.

    This is the loop:

    
    				if ( $all_query->have_posts() ) {
    					?>
    					<h2 id="opmeer" class="">Iedereen</h2>
    					<div class="<?php echo $column_class; ?>">
    						<?php
    						// Start the loop.
    						while ( $all_query->have_posts() ) {
    							$all_query->the_post();
    							get_template_part( 'loop-templates/content-collegas', get_post_format() );
    						}
    				} else {
    					get_template_part( 'loop-templates/content', 'none' );
    				}
    
  • Solved

    URL Field – tel: link rather than http:

    I’ve submitted this support ticket (hoping to get some advice soon) but thought the question maybe useful to the wider community as well…

    I’m new to your plugin (like it so far and using the current version) but I’m got a brick wall with the ‘URL’ field type.

    When I enter my ‘link’, which is a tel: link rather than http: or such like, I get an error message ‘Value must be a valid URL error’ and I can’t publish the post.

    I’m using what I believe to be the correct href syntax, i.e. <a href="tel:+1-201-555-0111">(201) 555-0111</a> which I got from rfc3966 and I’ve tried entering it into the field in these variations:

    <a href="tel:+1-201-555-0111">(201) 555-0111</a>
    href="tel:+1-201-555-0111">(201) 555-0111
    <a href="tel:+1-201-555-0111">
    href="tel:+1-201-555-0111"
    "tel:+1-201-555-0111"
    tel:+1-201-555-0111

    None of these work, and I’m out of ideas!

    I have another WP site that I’m using the normal link dialogue to use a tel:+1-201-555-0111 link and it works perfect, the validation error only seems to be via your plugin.

    I would appreciate any ideas please.

    Many thanks

  • Solving

    Validate a post doesn’t conflict with another post’s date/time field

    Ok bear with me on this one, I’ll try and simplify this as much as I can.
    Lets say I have a Custom Post Type of “Events”
    In those events I have a checkbox field for different kinds of events
    -Birthday
    -Anniversary
    -Housewarming etc

    In each post I have 2 date/time pickers one for start time and one for end time. If a start time is in the future the post status is set to “scheduled”.

    I’d like to do a check so no two types of events can be scheduled during the same time. So no two birthday events can have overlapping start and stop times.

    My first thought was to query any posts that are currently have a status of publish or future, then compare all that have the same type checkbox and then compare date/times but I’m not sure if I’m over complicating things…or not complicating things enough.

  • Solved

    timepicker and timezone

    I need to display event CPTs limited by date (today) and time (event is now running).
    To do so, I’m using a meta query comparing

    • a date picker field to date(‘Y-m-d’)
    • a start time picker field to date(‘H:i:s’)
    • an end time picker field to date(‘H:i:s’)

    To be able to use local server time correctly, I need to add date_default_timezone_set(“Europe/Berlin”) before doing php date / time camparisons.

    However, as soon as this is added, all ACF time / date fields start displaying and calculating as UTC time, i.e. a meta entry of 12:15:00 in the database is displayed as 11:15:00 using ACF template functions.

    Even doing ridiculous stuff like
    date_default_timezone_set("Europe/Berlin");
    $starttime = date('H:i:s', strtotime( get_field( 'event_starttime' ) ) );
    doesn’t seem to help.

    Is there an easy way to solve this without having to dive into (to me) incomprehensible and overcomplicated (again, to me) DateTimeImmutable or datefmt_format stuff?

  • Unread

    Cookie check failed – Update current logged in user meta fields

    Trying to update a repeater field that is part of a custom field group from ACF pro. The field group “show in rest api” is enabled. The condition of the field group is “current user is logged in”.

    Made a custom post type with ACF, when a logged in user visits the custom post type single page template, the user should be able to click a button “book flight” which will trigger the javascript to trigger a post request with the title of the current post. The javascript will update the user meta field repeater field so users can have an overview of all the booked flights.

    The issue that arises, is & 403 forbidden. The request url is https://www.doamainname.com/wp-json/acf/v3/users/14 and the header contains a valid X-Wp-Nonce. But it seems the nonce is always the same (caching turned off). The error that I get is:

    
    {
        "code": "rest_cookie_invalid_nonce",
        "message": "Cookie check failed",
        "data": {
            "status": 403
        }
    }
    

    Code setup:

    1. Enqueu scripts, using the wp_create_nonce(“acf”) in a php file with the code snippets plugin set to “run snippet everywhere”.

    
    function enqueue_custom_scripts() {
    // Enqueue JavaScript file
    wp_enqueue_script('your-script-handle', get_template_directory_uri() . '/custom/dzdze512/js/custom-fetch-file.js', array('jquery'), null, true);
    
    // Pass the user ID to the JavaScript
    wp_localize_script('your-script-handle', 'userData', array(
    'userId' => get_current_user_id()
    ));
    
    }
    add_action('wp_enqueue_scripts', 'enqueue_custom_scripts');
    
    function localize_custom_script() {
    // Get the ACF nonce
    $acf_nonce = wp_create_nonce('acf');
    
    // Define the data to pass to JavaScript
    $script_data = array(
    'nonce' => $acf_nonce
    );
    
    // Localize the script with the data
    wp_localize_script('your-script-handle', 'acfData', $script_data);
    }
    add_action('wp_enqueue_scripts', 'localize_custom_script');
    

    2. javascript file in file directory:

    
    // JavaScript function to send a POST request to add a subfield to the "my_flights" repeater field
    function addSubfieldToMyFlights() {
      // Get the flight name from the current post
      var flightName = "<?php echo get_the_title(); ?>"; // Use PHP to fetch the flight name
      // Create a field name by replacing spaces with underscores
      var fieldName = flightName.replace(/ /g, '_');
    
      // Prepare the data to send in the request
      var postData = {
        fields: {
          'my_flights_customer': [ // Use the actual field name
            {
              // Add a subfield of type text with label and field name
              'subfield': {
                field_type: 'text',
                field_label: flightName, // Label based on the post title
                field_name: fieldName // Field name with spaces replaced by underscores
              }
            }
          ]
        }
      };
      
      // Access the user ID from the localized script data
      var currentUserId = userData.userId;
      
      // Construct the URL for the fetch request
      var url = '/wp-json/acf/v3/users/' + currentUserId;
    
      // Send a POST request to the ACF REST API using the constructed URL
      fetch(url, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'X-WP-Nonce': acfData.nonce, // Include a nonce for security
        },
        body: JSON.stringify(postData),
      })
      .then(response => response.json())
      .then(data => {
        // Handle the response if needed
      });
    }
    

    3. Handling of post request in a php file with the code snippets plugin set to “run snippet everywhere”.

    
    // PHP function to handle the POST request and update the "my_flights_customer" repeater field
    function handleAddSubfieldToMyFlights() {
      if (is_user_logged_in() && isset($_POST['fields']['my_flights_customer'])) {
        $user_id = get_current_user_id();
        $my_flights_customer = get_field('my_flights_customer', 'user_' . $user_id); // Get the current "my_flights" data
    
        // Add the new subfield to the existing "my_flights_customer" data
        $newSubfield = array(
          'field_key' => 'field_' . uniqid(), // Generate a unique field key
          'field_type' => 'text',
          'field_name' => sanitize_title(get_the_title()), // Field name based on the post title
          'field_label' => get_the_title() // Label based on the post title
        );
    
        if (empty($my_flights_customer)) {
          $my_flights_customer = array(); // Initialize the "my flights" repeater field if it's empty
        }
    
        $my_flights_customer[] = $newSubfield;
    
        // Update the user's "my_flights_customer" repeater field
        update_field('my_flights_customer', $my_flights_customer, 'user_' . $user_id);
    
        // Send a response if needed
      }
    }
    
    add_action('wp_ajax_add_subfield_to_my_flights', 'handleAddSubfieldToMyFlights');
    

    I have tried using the wp_rest action, but using this sets me back a step. As the error in that case is a 404 not found. Meaning the url is not build correctly when using wp_rest action and ScoreSettings.nonce.

    Does anyone know how to fix this?

  • Helping

    How to sort taxonomy archive by ACF date field?

    The following code works with my custom post type “game”:
    function ptc_customize_wp_query( $query ) {
    if ( $query->is_post_type_archive( 'game' ) ) {
    // Sort portfolio posts by project start date.
    $query->set( 'order', 'DESC' );
    $query->set( 'orderby', 'meta_value_num' );
    // ACF date field value is stored like 20220328 (YYYYMMDD).
    $query->set( 'meta_key', 'release-date' );
    }
    }

    But my custom posts “Game” also have custom taxonomies like “genre”. How can I apply this sorting to these custom taxonomies as well?

  • Helping

    How to output URL as text safely?

    I have absolutely no idea what is HTML escaping, but your documentation advises using this escaping.
    We don’t recommend outputting any ACF value without any sort of protection or escaping.
    So, I want to output a simple URL custom field in a way that would display my custom text instead of URL. I.e. I want url to look this way: <a href="https://example.com">MY TEXT</a>.

    How can I edit this example code to save that escapiness and enter my custom text to the link?

  • Solving

    how to use ACF Post types to refine woocommerce product searches in Avada

    Hi I have a website with woocommerce in Avada with ACF pro.

    I have 3 custom fields set up and added to woocommerce products, these fields show in the add/edit products page, and show on the woocommerce product page. This part is working perfectly.

    I have a form set up which posts the query using the method GET to /?s=
    in the form is a hidden field with the value post_type=product
    in the form is a drop down menu withe the value product_cat in the Field Name and a list of the category names and slugs in the options menu.

    So far this part works fine, I can search for anything, and refine the search by product category.

    The part I need help with is include the ACF custom fields in the form to refine the search further.

    What values should I use for the three ACF custom fields?

    For example the first custom field set up in ACF is a Post Type called Authors (the plural label is Authors, the singular label is Authors, and the Post type key is authorname, under taxonomies is Product Visibility)

    Under the main Taxonomies tax on the left there is nothing.

    How do I go about adding this Post Type as another refining factor in the search form.
    I can add a text field but what should I set as the Field Name?

  • Solved

    Return format change cause any data issues?

    I’m setting up all required custom fields and entering their data in WP admin and leaving the return format set at its default i.e. Value as I’m not working with the template file yet.

    If I need to set the return format to anything else i.e Label, or Both (Array) when I come to that, will this see the potential removal of field data I already entered? So far I can tell that only changing the field name causes the data to disappear.

    Thanks,

Viewing 25 results - 376 through 400 (of 21,345 total)