Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Hi @alexgold05

    You are missing the $post_id parameter from the update_field function:
    http://www.advancedcustomfields.com/resources/functions/update_field/

    Please change your code to:

    
    $field_name = "dashboard_page";
    $value = "new page name";
    update_field( $field_name, $value, 'option' );
    
  • Hi @sidney.gpa

    It is possible to use ACF to render your select field. Then, your front end select field will behave the same as your back end select field.

    You can do so like this:

    
    $field_key_xyz = "field_52e81ce100934";
    $field = get_field_object($field_key_xyz);
    create_field( $field );
    

    Thanks
    E

  • Hi @andrefelipe

    The point of the field’s key is to be a unique identifier. The field name may be the same, but never the field key.

    There is no solution or fix to this other than modifying your fields to use different keys.

    You can use the field_name in your template files (get_field($field_name)).

    Thanks
    E

  • Hi @Grégoire Noyelle,

    Thanks for the feature request 🙂

    Have a great day

  • Hi @debosset

    Am I correct in assuming your question is this:
    i don’t know how to get the field that is number with the select field

    Can you please better describe this issue?

    Perhaps you could read over the has_sub_field or have_rows or repeater field documentation articles?

    Your code is far to complex for me to offer any free ACF support, perhaps you can be very specific as to what you need help with, as I can’t provide the time to debug your entire code to understand what does and doesn’t work.

    Thanks
    E

  • Hi @Athen

    I don’t understand your question. ACF does not create post types, it creates custom fields.

    Genesis is a theme, ACF saves data to a post.
    You can edit your theme to show ACF data.

    Thanks
    E

  • Hi @R3dDevil

    Thanks for the clarification. yes, this wuld be great for your workflow, but it seems that the jQuery date picker does not support multiple selections.

    Thanks
    E

  • Here’s the code from functions.php

    add_action( 'pre_get_posts', 'vendor_sort' );
    function vendor_sort( WP_Query $wp_query ) {
        // Ensure it is the global $wp_query
        if ( ! $wp_query->is_main_query() )
            return;
        
        if ( $wp_query->is_tax( 'vendor-type' ) ) {
            $wp_query->set( 'meta_key', 'crfp-average-rating' );
            $wp_query->set( 'orderby', 'meta_value_num' );
            $wp_query->set( 'meta_compare', '>' );
            $wp_query->set( 'order', 'DESC' );
        }
    }
  • Hi @tadywankenobi,

    You could check to see if a required field is empty in the first post?
    Eg if get_field(‘name’) is empty then do something, else something else

    cheers

  • Hi @lsterling03,

    The problem is that the same global variable is being used by both loops (inner and outer) so that when your inner loop breaks or ends, the outer loops pointer no longer points to the required field in the array.

    AS stated above Nested Repeaters are not supported, and would require you to do some coding that is unfortunately, outside the scope of this support forum.

    Cheers

  • Hi @lkraav,

    CPT do have changeable conditions for being shown? When you go to the ACF Add/Edit feild group page, it is below where you add the fields.

    What you want, is to change the conditions to “Page” “is not equal to” “Child”

    Let me know if this fixes your problem,

    Cheers

  • I’m looking to replace the actual WP ‘title’ of the post.

    So that it would reflect here…

  • Hi @manonatelier,

    Thanks for the clarification. I do not believe this is possible. I will raise a feature request for Elliot to take a look at for you.

    Thanks for your patience. 🙂

  • Hi @sixfootjames,

    Just so you know. This is not Elliot, we are here to help him with his super popular plugin. 🙂

    I would consider doing this using jQuery and AJAX. You could use ACF to generate your original select and a blank select.

    And then write some generic PHP to accept an AJAX request with the selection and then return a data set to populate the second select.

    IMO, this would make for a better UX.

  • This reply has been marked as private.
  • Hey, @elliot.
    First, thank you for your attention.

    Actually, what I did was to copy all the code from the post I’ve added as a reference (http://support.advancedcustomfields.com/forums/topic/how-do-i-get-optgroups-in-the-select-field/) and when I created a Select Field in the Admin Panel, I added the choices like the post. For example:
    -Europe
    Germany
    France
    -South America
    Brazil
    Argentina

    The point is that when I am trying to select the choices when I am adding a post, everything works perfectly. All the “-” choices are written as optgroup and the other choices are options, but when I am trying to display this select in my theme home page, i don’t know what kind of code I have to insert to have the same appearance as the admin panel post select.

    I know if I needed just to get the choices of a common select element with no optgroup the code below will work fine, but what code should I need to insert to have the optgroup select element displayed correctly?

    
    $field_key_xyz = "field_52e81ce100934";
    $field = get_field_object($field_key_xyz);
    					
    if( $field )
    {
    echo '<select name="' . $field['name'] . '" id="' . $field['name'] . '">';
    foreach( $field['choices'] as $k => $v )
    	{
    	echo '<option value="' . $k . '">' . $v . '</option>';
    	}
    echo '</select>';
    }
    

    Can you help me with that?

  • Ok, done some more digging/reading.

    The sanitize_meta function I mentioned above simply adds a filter that you can then hook to do custom sanitization. As per the codex function – it doesn’t do any sanitization itself. So that’s kind of irrelevant.

    However, further down, the actual DB update is done using $wpdb->update, which does escape the data.

    What I’m not entirely sure yet is whether one then needs to do any additional sanitization. Also whether I’m ok to use the_field, get_field etc as-is when outputting data, or whether these need escaping?

    This post was helpful: http://wordpress.stackexchange.com/questions/44807/sanitize-vimeo-embed-code

  • This reply has been marked as private.
  • Andy, I converted the method into a standalone function (it was used in a bigger class).

    You can use it by simply calling get_acf_title( get_the_ID() )

    On ACF admin you add a metabox with title field (which is set as a text field).

    Here is a quick view of the admin part:
    http://img.iamntz.com/jing/2014-01-30-15@15h24_4.png

  • I know how to display “custom fields” or “custom taxonomy”, question about how to insert data into “custom taxonomy” from frontend. Their is any javascript function or anything. Its too complex, …

  • ACF v5 pro

    Should we understand there will be a lite and a pro version? One free and one.. not that free?

    Any ETA for v5?

  • Hi Elliot,
    Many thanks for the quick response.
    I’ve had a look at update_postmeta in post.php, which in turn calls update_metadata in meta.php.

    update_metadata calls a sanitize_meta function (also in meta.php), but what I’m not sure is what this does exactly – this is the function:

    function sanitize_meta( $meta_key, $meta_value, $meta_type ) {	        return apply_filters( "sanitize_{$meta_type}_meta_{$meta_key}", $meta_value, $meta_key, $meta_type );
    }

    According to Codex:

    ‘Applies filters that can be hooked to perform specific sanitization procedures for the particular metadata type and key. Does not sanitize anything on it’s own. Custom filters must be hooked in to do the work. The filter hook tag has the form “sanitize_{$meta_type}_meta_{$meta_key}”. ‘

    But this is where I get a bit lost… does this mean data is being sanatized or not?!

    Also – do you know whether it’s just update_postmeta I need to worry about, or are there any other methods used too?

    Many thanks for your help.
    Sarah

  • Hi @elliot,

    thank you for your answer.
    We use a OO-Form to create our new WP-page. After we create this page we use the following function to save the values:

    public function updateFields($cover_pic_id) {
            // update all custom fields in the projects page
            update_field('project_name', $_POST[PNAME], $this->post_id);
            update_field('short_description', $_POST[SHORTDESC], $this->post_id);
            update_field('overview_text', $_POST[OVERVIEW], $this->post_id);
            update_field('equity_text', $_POST[EQUITY], $this->post_id);
            update_field('start_date', $_POST[STARTDATE], $this->post_id);
            update_field('end_date', $_POST[ENDDATE], $this->post_id);
            update_field('investment_goal', $_POST[INVGOAL], $this->post_id);
            update_field('keywords', $_POST[KEYWORDS], $this->post_id);
            update_field('cover_pic', $cover_pic_id, $this->post_id);
        }

    ($this->post_id is a private member variable that saves the post-id of the page just created)

    So all in short on submitting:

    $this->createNewProject();
    $this->updateFields($cover_pic_id);  // update custom fields in project

    maybe we do have to update the fields before we create the page? but that would not be logical?

    As mentionned the values are visible in the backend, but we cannot access them with get_field() before saving the page manually.
    Thanks Julson

  • Hi Elliot,
    I changed the get_field to `presentation_details’ and all my data disappeared.
    The data before has the format where the ‘get_field’ and ‘has_sub-field’ are different

     <?php if(get_field('event_programme')): ?>
       <?php while(has_sub_field('event_details')): ?> 
        <thead> <tr> <th colspan="3">
    	<?php the_sub_field('start_time'); ?> - <?php the_sub_field('end_time'); ?>
             	</th> </tr> </thead>

    and it works fine to pull in the time so I thought the other would be fine too. And it is except for pulling in the different icons! Weird isn’t it. Maybe it’s just not possible to call in that ‘event_type’ field.

  • Hi Elliot,

    Thanks for taking the time to look at this for me. The output of the var_dump is:

    array(8) { ["title"]=> string(0) "" ["name"]=> string(0) "" ["address"]=> string(0) "" ["email"]=> string(0) "" ["website"]=> string(0) "" ["telephone"]=> string(0) "" ["telephone2"]=> string(0) "" ["telephone3"]=> string(0) "" }

    (Sorry, should have included it with the original question)

    It’s weird. I’m fully convinced I have this functionality working on another project, I just can’t remember which one.

    Cheers,

    T

Viewing 25 results - 18,926 through 18,950 (of 21,345 total)