Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Now we’re getting somewhere!

    What is your field type? Are they choosing via radio buttons or select?

    To get the value (not the name) of your radio/select, you just do it how I explained above:

    echo '<div class="' . get_field('header_bullets_and_testimonials_colour') . '">';

    Just make sure your field ‘Choices’ are setup to work as classes… so it would be:

    class-one | Class One
    class-two | Class Two

    … as seen in the first image here: http://www.advancedcustomfields.com/resources/checkbox/

  • Without seeing what you’re actually doing, it’s hard to really help. This code is kind of confusing to me. echo ($show_size == "full") ? do_shortcode(nl2br(get_the_content(' '))) : get_the_excerpt();

    Your above code doesn’t actually put the get_field() function into the content area, so you wouldn’t be seeing anything on the front end.

  • To all still wondering…
    If you have field type “relation” that pulls list of all posts in your database and your db contains a lot (!) of posts, that query might time out, so the rest of the page is not rendered properly hence the error occurs.

  • Download & Open /includes/functions/general.php
    REMOVE the final ?>
    Upload the amended file.
    And: http://bit.ly/1cyIhDI
    etui sony xperia e3
    etui galaxy A5

  • The conditional fields feature is only supported in DocuSign Business, Enterprise, System Automated (SA), DocuSign for REALTORS, and DocuSign for Real Estate plans. Your account may not support this option. To access this functionality, contact your Account Manager or DocuSign Support for assistance. etui samsung galaxy alpha housse galaxy alpha

  • I’m seeing the same as eboles above. If the meta data stored in the custom field doesn’t match the post’s taxonomy data (for example, if the post’s taxonomy terms were changed using quick edit), the field is displayed as empty on the edit page.

  • I’ve tried changing that to quite a few things, but the one that I think is probably right is

    Post Type is equal to testimonial_rotator

  • How about this… what is your field group location set to?
    https://www.dropbox.com/s/16qavfmivxcyyrk/acf-field-group.png?dl=0

  • Glad I found this thread! I was trying to combine a relationship field and have that place a pin on the map. Here’s the code I have that works for me:

    <?php $posts = get_field('featured_space'); if( $posts ): ?>
      <div class="acf-map">
        <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
          <?php setup_postdata($post); ?>
            <?php $space_address = get_field('space_address', $post->ID); ?>
              <div class="marker" data-lat="<?php echo $space_address['lat']; ?>" data-lng="<?php echo $space_address['lng']; ?>">
                <h4><?php the_title();?></h4>
                <p><?php echo $space_address['address']; ?></p>
    					</div><!--/.marker-->
    	  <?php endforeach; ?>
        <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    	</div><!--/.acf-map-->
    <?php endif; ?>

    Or if that does not work here’s a link to a gist with the code: Gist

  • Was just about to post a similar request myself. I’m missing atleast a more flexible way of styling the form.

    Having to use javascript and lots of !important’s to override current styling, is a real pain… Hope this will be a feature in a near future 🙂

  • Try this with the first line.. you shouldn’t be getting the actual get_field code in the HTML

    echo '<div class="' . get_field('header_bullets_and_testimonials_colour') . '">';

  • Sorry – I’ve been having problems explaining it! I’ll do my best to break down what I am trying to do.

    I’ve created a custom field type called testimonials, and set up a multiple choice for the specific colour.

    I have set the custom field type to display on the testimonials rotator section for the plugin.

    When you are in the testimonial rotator, you can choose which colour you want – so this part of the plugin is working fine.

    Within the section that is printing the testimonials on each page – which is in the file loop-testimonial in the actual plugin, I have tried added the code as above, with in mind that it will print the chosen colour. This will then set the css class, which has been set in styling.

    However, what I am getting when I do this is the following code printed:

    <div class=".get_field('header_bullets_and_testimonials_colour');">
    <div class="testimonial_rotator_quote">
    Quote goes here.</div>
    </div>

    The code I am inputting to the loop-testimonials.php file is

    echo "<div class=\".get_field('header_bullets_and_testimonials_colour');\">\n";
    echo "<div class=\"testimonial_rotator_quote\">\n";
    echo ($show_size == "full") ? do_shortcode(nl2br(get_the_content(' '))) : get_the_excerpt();
    echo "</div>\n";
    echo "</div>\n";
  • Code I am attempting to add in is:

    <div class="<?php the_field('header_bullets_and_testimonials_colour'); ?>">
    

    For the testimonials, and for the blog section it is

    `<?php

    $image = get_field(‘featured_image’);

    if( !empty($image) ): ?>

    <img src=”<?php echo $image[‘url’]; ?>” alt=”<?php echo $image[‘alt’]; ?>” />

    <?php endif; ?>`

    Both of which are working on other parts of the same WP install.

  • I found a way round this by using a ‘Choice’ field and dynamically populating it.
    Essentially I populate the choice field with the categories I want, I can choose if it is a radio, check or select etc, and then on update/publish of the post I get the selections and save them back to the post.

    Using this function you can dynamically populate the choice field: http://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/

    I then used the save_post function to save the data back to the post. http://www.advancedcustomfields.com/resources/acfsave_post/

    /**
     * dynamically set options for date select field
     * @param array $field
     * @return type
     * @see http://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/
     */
    function my_acf_date_field($field) {
        //get child categories of category date
        $args = array(
            'type' => 'post',
            'child_of' => 8, //date category parent
            'parent' => '',
            'orderby' => 'name',
            'order' => 'ASC',
            'hide_empty' => 0,
            'hierarchical' => 1,
            'exclude' => '',
            'include' => '',
            'number' => '',
            'taxonomy' => 'category',
            'pad_counts' => false
        );
        //get the child categores 
        $categories = get_categories($args);
    
        //array of choices to add to field
        $choices = array();
    
        /**
         * add each category to $choices array
         */
        foreach ($categories as $category) {
            // var_dump($category);
            $id = $category->cat_ID;//set value as category id
            $name = $category->cat_name;//label as category name
            $choices[$id] = $name;
        }
    
        //add choices to field
        $field['choices'] = $categories;
        return $field;
    }
    
    // acf/load_field/name={$field_name} - filter for a specific field based on it's name
    add_filter('acf/load_field/name=date', 'my_acf_date_field');
    
    /**
     * Save the data to the post
     * @param type $post_id
     * @return type
     * @see http://www.advancedcustomfields.com/resources/acf_save_post/
     */
    function my_acf_save_post($post_id) {
    
        // bail early if no ACF data
        if (empty($_POST['acf'])) {
            return;
        }
    
        //array of category id's
        $categoryIds = array();
    
        //value of 'date' field is the cat_id
        $dateCatId = get_field("date");//http://www.advancedcustomfields.com/resources/get_field/
        array_push($categoryIds, $dateCatId);
    
        //set value of category fields onto post
        //http://codex.wordpress.org/Function_Reference/wp_set_post_categories
        wp_set_post_categories($post_id, $categoryIds);
    }
    
    // run before ACF saves the $_POST['acf'] data
    //add_action('acf/save_post', 'my_acf_save_post', 1);
    
    // run after ACF saves the $_POST['acf'] data
    add_action('acf/save_post', 'my_acf_save_post', 20);
  • Running 5.1.5 as well and taxonomy fields are not loading for me either. Like RichB, I have multiple taxonomy fields in the edit post area–with 4 ACF fields covering 3 custom taxonomies and the built-in category taxonomy.

    The taxonomies all have data as seen in the database and quick editor, but they’re showing as empty within edit post and saving the post with them empty clears the taxonomy values that did exist.

  • Eureka!

    Thanks to @ractoon and this snippet i managed to solve it:
    http://www.ractoon.com/2014/11/acf5-pro-color-picker-custom-palettes/

    This is how my function looks right now:

    In my child themes functions.php i declare the colors:

    // Adds client custom colors to WYSIWYG editor and ACF color picker. 
    $client_colors = array(
        "222222",
        "8dc4d5",
        "e1523d",
        "eeeeee",
        "323232"
    );

    Then in my main themes functions.php:

    global $client_colors;
      array_push($client_colors, "FFFFFF", "000000");
    
      function change_acf_color_picker() {
    
        global $parent_file;
        global $client_colors;
        $client_colors_acf = array();
    
        foreach ( $client_colors as $value ) {
          $client_colors_acf[] = '#'.$value;
        }
    
        $client_colors_acf_jquery = json_encode($client_colors_acf);
    
        echo "<script>
        (function($){
          acf.add_action('ready append', function() {
            acf.get_fields({ type : 'color_picker'}).each(function() {
              $(this).iris({
                color: $(this).find('.wp-color-picker').val(),
                mode: 'hsv',
                palettes: ".$client_colors_acf_jquery.",
                change: function(event, ui) {
                  $(this).find('.wp-color-result').css('background-color', ui.color.toString());
                  $(this).find('.wp-color-picker').val(ui.color.toString());
                }
              });
            });
          });
        })(jQuery);
      </script>";
      }
    
      add_action( 'acf/input/admin_head', 'change_acf_color_picker' );

    One problem remains though: when i click(not drag circle) on the colorpicker, it seems to hold the old color value from when i’ve grabbed the circle and dragged it around. This becomes obvious when i drag the vertical slider.

  • Kudos to you guys for trying to solve this. I tried above solution but can’t get it to work 100%.

    I managed to solve to things:

    1. When changing palettes the mode in iris changes aswell. i solved this by adding: mode: ‘hsv’,(See documentation: http://automattic.github.io/Iris/). This is standard in wpColorPicker that acf uses.
    2. Sometimes the values in the hex value box didn’t change when i did changes on the color picker, i think that is solved now.

    See my revised jquery code below:

     <script>
            jQuery(document).ready(function($){
              if ($('.acf-color_picker').length) {
                $('.acf-color_picker').each(function() {
                  $( this ).iris({
                    mode: 'hsv',
                    palettes: ['#e40571', '#4b63a4', '#ffcb05', '#fff', '#000'],
                    change: function(event, ui){
                      $(this).find('.wp-color-result').css('background-color', ui.color.toString());
                      $(this).find('.wp-color-picker').val(ui.color.toString());
                    }
                  });
                });
              }
            });
            </script>

    HOWEVER
    I use Flexible Content for some of my color picker fields and those are not initialized on page load. Therefore above hack doesn’t affect them.

    I think the best solution is to do these changes when ACF initializes.

    The only way i could accomplish this was to change the file: /wp-content/plugins/advanced-custom-fields-pro/js/input.min.js

    Which isn’t good since it will get removed on updates.

    I would really appreciate if Elliott or someone could help to solve this via a function or a plugin.

    Best regards
    Anton

  • Sounds good, let us know.

    When I discussed it with Rackspace they said that cURLing to the server resulted in 403 forbidden errors when attempting to connect to http://connect.advancedcustomfields.com/index.php?a=get-info&p=pro :

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>403 Forbidden</title>
    </head><body>
    <h1>Forbidden</h1>
    <p>You don't have permission to access /index.php
    on this server.</p>
    <p>Additionally, a 403 Forbidden
    error was encountered while trying to use an ErrorDocument to handle the request.</p>
    <hr>
    <address>Apache Server at connect.advancedcustomfields.com Port 80</address>
    </body></html>

    and when trying to access http://assets.advancedcustomfields.com/add-ons/add-ons.json:

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>403 Forbidden</title>
    </head><body>
    <h1>Forbidden</h1>
    <p>You don't have permission to access /add-ons/add-ons.json
    on this server.</p>
    <p>Additionally, a 404 Not Found
    error was encountered while trying to use an ErrorDocument to handle the request.</p>
    <hr>
    <address>Apache Server at assets.advancedcustomfields.com Port 80</address>
    </body></html>
  • @qwik3r I cannot believe your post hasn’t even been read, let alone addressed.

    We have had the same issue when upgrading from 4 to 5 Pro, i.e. loads of duplicated fields although not all fields were duplicated. Some were, some weren’t.

    We spent a whole day on this yesterday and had to give up as the process is clearly flawed and cannot be trusted.

    So for now we will stick with 4 🙁

    We’re really disappointed as the time we wasted yesterday is lost and can never be brought back into our lives. Our time wasted on updating far outweighs the value of the add-ons we purchased.

  • I got this working by enqueuing some jQuery in my functions.php:
    https://github.com/scribu/wp-posts-to-posts/issues/469

  • Sure,

    I call this in my custom plugin..

    
    /* acf post generate */
    
    function create_acf_post( $post_id )
    {
        // check if this is to be a new post
        if( $post_id != 'new' )
        {
            return $post_id;
        }
    
        // Create a new post
        $mytitle = get_user_meta( get_current_user_id(), 'nickname', true ) . ' - ' . $_POST['fields']['field_547959d79b64c'];
        $post = array(
            'post_status'  => 'draft' ,
            'post_title'  => $mytitle,
            'post_type'  => 'ifcc'
        );  
    
        // insert the post
        $post_id = wp_insert_post( $post );
    
        // update $_POST['return']
        $_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );    
    
        $user_id = get_current_user_id();
        update_user_meta( $user_id, 'done_free', '1' );     
        // wp_redirect('/');
    
        // return the new ID
        return $post_id;
    }
    
    add_filter('acf/pre_save_post' , 'create_acf_post' );
    

    and that is fired on frontend while after couple of pars are meet,, frontend, is single, is custom post (ifcc) and logged in..

    
    // =============================
    // frontend single ifcc logic 
    // =============================
    
    function cpt_front($query) {
        if ( !is_admin() && $query->is_main_query() ) {
            if ($query->is_single() && $query->post_type == 'ifcc' ) {
                if( is_user_logged_in() ){
                    $user_id = get_current_user_id();
                    $usernick = get_user_meta( $user_id, 'nickname', true );
                    update_field('submitee_name', $usernick);
                    $free = get_user_meta( $user_id, 'done_free', true );
                    if( $free == '1' ){
                        echo 'need to buy additional licence';
                    } else {
                        get_template_part( 'content', get_post_format() );
                        $args = array(
                            'post_id' => 'new',
                            'field_groups' => array( 68 )
                        );
                        acf_form( $args );
                    }
                } else {
                    // echo get_permalink( get_option('woocommerce_myaccount_page_id') );
                    echo do_shortcode('[woocommerce_my_account]');
                }
            }
        }
    }
    
    add_action('pre_get_posts','cpt_front');
    

    so, everything works cool, and post is inserted in backend and all, but redirect part if off somehow,,

    thanks

  • Here is the whole code:

    // Change Field into a select
    $field['type'] = 'select';
    $field['ui'] = 1;
    $field['ajax'] = 1;
    $field['choices'] = array();
    
    // get sites
    $sites = $this->acf_get_sites();
    
    // set choices
    if( !empty($sites) ) {
    
    	foreach( $sites as $site ) {
    		
    		//get blog name
    		$current_blog_details = get_blog_details( array( 'blog_id' => $site['blog_id'] ) );
    		
    		// append to choices
    		$field['choices'][ $site["blog_id"] ] = $current_blog_details->blogname;
    
    	}
    
    }
    
    // render
    acf_render_field( $field );

    Its almost the same like the post_object. I have no JS errors. Without ui and ajax its just fine.

  • If you’re connecting to a remote database, you’ll either have to write a custom SQL query or create a new wpdb instance (unsure of the latter).

Viewing 25 results - 17,451 through 17,475 (of 21,345 total)