Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • I found the problem. But don’t know how to fix it.

    After looking in the view-source of the page I found that there is a “form-data div” created for every calling of the acf_form function.
    <div id="acf-form-data" class="acf-hidden">.

    Once removing all these divs except the first one using the inspection tool in the browser, everything worked perfectly.

    The problem is that I don’t know how to define to the acf_form() how NOT to create unwanted extra data-form divs.

  • Hi,
    I have the same situation but with multiple checkbox,

    select_section = is where the post will be displayed (fine with that)
    pin_article = is a checkbox with few options (project is one of them), when is checked this post should be pinned on project page.

    Problem is making the pinned post to be displayd first on project page.
    work fine with single checkbox but with multiple values is not working anymore.

    Any solution to that?

    $query_args = array(
                'numberposts' => -1,
                'posts_per_page' => 4,  
                'post_type' => 'project_post',
                'meta_key' => 'pin_article',  
                'orderby' => 'meta_value',
                'meta_query'  => array(
                'relation'    => 'OR',
                  array(
                    'key'   => 'select_section',
                    'value'   => 'home',
                    'compare' => 'LIKE'   
                  ),
                  array(
                    'key'   => 'pin_article',
                    'value'   => 'project',
                    'compare' => 'LIKE'
                  )
                ));
  • My bad. I forgot to mention (or realize) I was trying to get this to work on a custom taxonomy page, so I forgot to include get_queried_object();

    Resolved now, thanks to my brain fart. Thanks for jogging my mind, John Huebner!

    In case anyone else needs it, here’s my fixed code.

    $queried_object = get_queried_object();
    $seals = get_field('seals', $queried_object);
    $countSeals = count($seals);
  • Guys, but table is broken, screen options don’t work
    http://cl.ly/lozJ

    ACF Qtranslate fixed for 5.6.0
    Download patch here
    https://github.com/Tusko/acf-qtranslate/commit/aefdf4e5645b489be60c57724c10f36ba2319ea7.patch

  • If it helps, this was the fix, but it requires you to edit ACF core. From Elliot:

    I’ve just done some testing and believe to have found a solution.
    Would you mind editing the ‘core/revisions.php’ file on line ~120 (wp_post_revision_fields function) and change it to:

    function wp_post_revision_fields( $fields, $post = null ) {
    		
    		// validate page
    		if( acf_is_screen('revision') || acf_is_ajax('get-revision-diffs') ) {
    			
    			// bail early if is restoring
    			if( acf_maybe_get($_GET, 'action') === 'restore' ) return $fields;
    			
    			
    			// allow
    			
    		} else {

    You will notice there is a new condition that checks if the post is restoring.
    This extra line should fix the issue.

  • Upon further research, the problem originates with class-acf-field-oembed.php – function get_ajax_query()

    The Group Field key is passed through to acf_get_field which returns false.

    If you comment out:

    
    // load field
    $field = acf_get_field( $args['field_key'] );
    if( !$field ) return false;
    
    // prepare field to correct width and height
    $field = $this->prepare_field($field);
    

    and put in a temp array:

    
    $field = [
    'width' => 300,
    'height' => 280
    ];
    

    Then the oEmbed in a Group Field works correctly.

    So the issue is with acf_get_field not being able to handle a Group Field key.

  • You can try this https://www.advancedcustomfields.com/resources/querying-relationship-fields/

    or you could try implementing this https://www.advancedcustomfields.com/resources/bidirectional-relationships/

    or you could try out a plugin like https://wordpress.org/plugins/post-2-post-for-acf/

    The last 2 will not update the relationships automatically. You’d need to edit all the posts on one side or the other. There are a lot of topics here on the forums about the first option, but I generally use the last one.

  • This was added because of many requests to add it. It’s probably too new for anyone to know how to remove it. You might want to open a support ticket to suggest it be removable https://support.advancedcustomfields.com/new-ticket/

  • if you’re trying to get the images from the related posts then you need to get those fields inside of the loop for those posts

    
    //homepage
    
    <?php
    
    $posts = get_field('correlati_vini');
    
    if( $posts ): ?>
    <div class="wine-list">
     <div class="row row-news ">
     <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
        <?php 
          setup_postdata($post);
          
          $image = get_field('copertina_libro');
          $correlata = get_field('copertina_libro_correlata');
          $size = 'thumbs-liste'; // (utilizzo la mia dimensione personalizzata)
          $sizefull = 'full'; // (utilizzo la dimensione originale)
        ?>
        <div class="col-md-4">
            <div class="featured-image">
              <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><img class="img-responsive" src="<?php echo wp_get_attachment_image( $image, $size ); ?>" /></a>
            </div>
    .....
    
  • There isn’t an easy way to do this. You will need to

    1) Get all the posts of the post type
    2) Check to see if the field already has a value
    3) update if it doesn’t

    Depending on the number of posts involved, this process could very well time out before completion.

    The better alternative is to set a default value if the field does not contain a value.

    
    $value = get_field('field_name');
    if (!$value) {
      $value = 'set some default value';
    }
    

    The checking of this may need to be more complex, but that’s the idea.

    Alternately you could add an acf/load_value filter to the field and return a default value from this and this would not require altering templates where it’s used https://www.advancedcustomfields.com/resources/acf-load_value/

  • For anyone looking, select2 has changed maximumSelectionSize to maximumSelectionLength. An updated version of the above:

    
    (function($) {
    	acf.add_filter('select2_args', function( args, $select, settings ){
    		// limit to 3
    		args.maximumSelectionLength = 3;
    		return args;
    	});
    	
    })(jQuery);	
    
  • This does not work. Adding the ‘orderby’ param does not work. Adding what seems to be any other WP_Query arg does seem to work (i.e. the ‘order’ param). Is there any chance at all that the args are being tweaked after the ‘apply_filters’ for this hook?

  • Works like a charm, thanks so much!

    Here’s the solution if it helps anyone:

    $img = get_field('banner_image', 'category_' . get_queried_object()->term_id);
    if ($img) {
        echo $img;
    }
  • Since you’re setting them as featured when editing the post, I would also include support for “Page Attributes” in the setting for the CPT and then set the order using the built in order field. Then I’d use this field for to order the posts in the query that gets the featured posts

    
    //.....
      'orderby' => array('menu_order' => 'ASC');
    //.....
    

    or

    
    //.....
      'orderby' => 'menu_order',
      'order' => 'ASC'
    //.....
    

    depending on how you write your WP_Query args

  • The error would be in the file options-page.php, in function postbox_submitdiv(){…} ?

    Button text output has not been translated:

    value="<?php echo $this->page['update_button']; ?>"

    Solution:

    value="<?php echo __($this->page['update_button']); ?>"

  • Hi John,

    Actually, there is not any timeout problem on our ACF pages. The problem is that sometimes if we add too much content on a page and if we update or save that page, total or half of the page content gets lost.

    To overcome this problem, we have tried to apply your suggestions in your first comment. And we have changed the values of some input parameters. But at the end of our tests, we couldn’t find any rational and visible relation between the input length parameters and the page content loss.

    The “values/test results” relation has occurred in like the list below.

    -If the max_input_vars = 999999999999999999999999999 => no content loss
    -If the max_input_vars = 999999999999999999999999999 => content loss
    -If the max_input_vars = 1000 => content loss
    -If the max_input_vars = 9223372036854775807 => no content loss
    -If the max_input_vars = 999999999999999999999999999 => no content loss
    -If the max_input_vars = 1000 => no content loss
    -If the max_input_vars = 999999999999999999999999999 => no content loss
    -If the max_input_vars = 999999999999999999999999999 => no content loss
    -If the;
    max_input_vars = 1000
    suhosin.get.max_vars = 1000
    suhosin.post.max_vars = 1000
    suhosin.request.max_vars = 1000 => content loss
    -If the;
    max_input_vars = 999999999999999999999999999
    suhosin.get.max_vars = 999999999999999999999999999
    suhosin.post.max_vars = 999999999999999999999999999
    suhosin.request.max_vars = 999999999999999999999999999 => no content loss

    As you view, there is not a visible relation between the values of the parameters and their test results.

    Now we are stuck in the solving the content loss problem on ACF pages. We want to learn that; in which other conditions can page content loss occur?

  • I’ve been having the same issue. The developer has mentioned on the GitHub repository that he will be updating the plugin today hopefully. More updates here… https://github.com/funkjedi/acf-qtranslate/issues/103

  • This isn’t an inefficiency or ACF. It’s more of a problem with WP, although, that’s not really the case either. The problems are that your query is creating many, many joins doing multiple searches on a database column than is not optimized for searching.

    This is explained in many places like https://wordpress.stackexchange.com/questions/158898/meta-query-terribly-slow and https://tommcfarlin.com/wp_query-and-multiple-meta-keys/.

    There might not be a way to actually correct this, what follows is only a possible work around that has not been tested.

    1. Split your OR meta queries and do 3 separate queries
    2. Return just the post IDs from these 3 queries
    3. Use array_merge() http://php.net/manual/en/function.array-merge.php to combine the results of the previous queries and array_unique() http://php.net/manual/en/function.array-unique.php to get only unique values $ids = array_unique(array_merge($array1, $array2, $array3));
    4. Use the resulting array to do a 4th query using this array as the post__in argument. You would only need to do your sorting by the date in this last query.
  • I’m not completely sure how WC works in this case, but no, I don’t think acf_form() will help you.

    Guessing that this is what’s happening

    1. Submit form
    2. WC does an AJAX request to submit the form
    3. WC redirects

    ACF fields have not been submitted yet, ACF does not run on the AJAX request, but if you use acf_form() it is still loading everything that it would normally load for field validation and detecting changes.

    In order to use acf_form() you would need to:

    1. Add an action to all form fields and the form submit action that would clear the flag that tells ACF that something has been changed – I don’t know how to do this
    2. You would need to call acf_form_head() in your filter – This is a guess, I don’t know if this will work
    3. You would still need an acf/pre_save_post filter to cause ACF to save the values to the user instead of $order_id

    There are a lot of pieces here and some of what needs to be done is unknown. For me, it would just be easier to hand code the form fields rather than use ACF form and then update the user ACF fields with those values using update_field(). The amount of work and code would be far less, not to mention the hours of testing that would be involved and possibly completely failing to get it to work since I’m not certain that it can be done.

  • When I have questions like this I generally create a field like the type I want to use for my field with the settings I want it to have and then do an export to code to see that the settings are.

    Never though of that… Thanks!!

  • I’m not seeing this when testing. It’s possible that it’s caused by a conflict with another plugin or your theme. Try deactivating other plugins and maybe changing themes to see if you can correct the problem. It may also be due to a PHP or JavaScript error during the AJAX request.

  • Indeed it is.

    In field group editor many fields, including field name, now appear to be translatable.

    Qtranslate WYSIWYG/Image/file fields are removed from field type dropdown and don’t appear anymore on pages/posts.

  • The easiest way would be to create a file field and set the allowed file types to .pdf. This will only allow the editor to select pdf files from the media library.

    If you want to do this the hard way you could https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/. You’ll need to do a query of the attachments to get all the pdf files to use to do the population. I’m not sure how you’d do this but this looks like it might do the trick https://wordpress.stackexchange.com/questions/22069/is-it-possible-to-query-specific-wordpress-attachment-files-ppt-pdf-and-ou

  • You’ve also go the wrong hook

    
    <?php 
      
      function acf_mod_styles() {
        ?>
          <style type="text/css">
            .acf-repeater.-row>table>tbody>tr+tr>td,
            .acf-repeater.-block>table>tbody>tr+tr>td {
              border-top-color: #a8a8a8; // about twice as dark
            }
          </style>
        <?php
      }
      add_action('acf/input/admin_head', 'acf_mod_styles');
      
    ?>
    
  • It may be that it was read, but that no one has read it that can help you. This is a users helping other users forum.

    The best help that I can offer is to point you to additional documentation, there is a section on this page that covers adding mutliple markers near the end of the page. https://www.advancedcustomfields.com/resources/google-map/

    There is also another post on it here, but it’s quite old so I don’t know if there’s anything in it that would be helpful https://support.advancedcustomfields.com/forums/topic/multiple-post-points-on-google-maps/

Viewing 25 results - 10,901 through 10,925 (of 21,317 total)