Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Hi guys.

    This is totally fine, but please read over the guidelines here:

    http://www.advancedcustomfields.com/resources/getting-started/including-lite-mode-in-a-plugin-theme/

    Basically, you need to make sure the update script is removed from the plugin if you intend on selling / distributing it.

    Whilst it is internal, you may keep the update script active.

    Does this help?

  • Hi @torbjorn_s

    Yes, this would be an excelent feature and is possible.

    Instead of outputing the value into the column, you need to create a checkbox input and use the value to set it’s checked attribute.

    Then, when you check it, you need to run some jQuery code to send an AJAX request to a custom PHP function which would accept the post_id and then update the value!

    Good luck

  • Hi @torbjorn_s

    Your query is filtering the posts to those that have a value for the control_reminders_enabled meta_key.

    If your posts does not yet have a value for this, then your query will not work.

    Perhaps you need to also add in the ability to treat posts without a value as a value of 0

    I’m not 100% sure how to do this, but chances are someone on stackexcahnge / google has already written / shared the code.

    Good luck

    Cheers
    E

  • Hi @Matthias

    The get_sub_field does not have an option for formatting.

    You will need to construct the $ids like so:

    
    <?php 
    
    $images = get_sub_field('gallery');
    $image_ids = array();
    
    foreach( $images as $image )
    {
    	$image_ids[] = $image['id'];
    }
    
    $shortcode = '[gallery ids="' . implode(',', $image_ids) . '"]';
    
    echo do_shortcode( $shortcode );
    
    ?>
    
  • Hi @Rakesh

    Sounds like you are creating defaults for images and falling back to default images in your theme.

    Perhaps this would be better left within the theme, as in, use an if statement to check if an image value exists and if not, use the one in your theme.

    To do what you wrote in the previous comment would require that you upload all default images to the WP library on theme activation. This would require a lot of code and PHP skills.

    Cheers
    E

  • Hi @davegrant

    Can you confirm that the user has the wysiwyg editor option enabled in their profile settings?

    Perhaps you could post some login details with instructions to view the edit page in question?

    You can post a reply as private.

    Thanks
    E

  • also curious about this, thanks for asking.

  • @edir

    I will attempt to answer the first question. ACF uses two types of field names in order to associate the field with its object; as you see in the postmeta table of your DB, only the value is saved (in “meta_value”) for the posts’ field name (in “meta_key”). So, in order to access the rest of the field object (e.g. “label”, “format”, “type”, “choices”, etc.), ACF must be able to look this up using a unique identifier (the key). This ensures that post meta is stored the way same as (and hence, compatible with) native WP meta. So, when ACF gets a field, it looks for the meta_key with the same name as the requested field but prefixed with an underscore – this gives it the key that allows it to find the rest of the object.

  • Update. I have now improved this to be an associate array instead:

    function updateoptionkeys() {
      $fields = array (
        "field_515d9fcb5bee9"=>0,
        "field_515d933e4347c"=>50,
        // etc...
      ); 
      
      foreach ($fields as $key=>$value) { 
        update_field($key, $value, "options");
      }
    }
    
    function myactivationfunction($oldname, $oldtheme=false) {
      updateoptionkeys();
    }
    add_action("after_switch_theme", "myactivationfunction");

    But this means it will revert back to default values everytime the user switch on/off the theme…

    Doesn’t get_field() work with field keyvalues instead of id/name anymore?

  • I thought this might’ve worked; but throwing out an undefined variable…

    $end_date_passed_check = DateTime::createFromFormat('Ymd', get_field('event_end_date'));
    	
    if ($end_date_passed_check < date('Ymd'))
    {
        $date_passed = 'date-passed';
    }

    <div class="each-programme-content <?php echo $date_passed; ?>"></div>

  • Current approach:
    (in functions.php)

    // Update option keys on theme activation
    function updateoptionkeys() {
      // BASE
      if (!get_field("field_515d9fcb5bee9", "options")) {update_field("field_515d9fcb5bee9", 0, "options");}
      if (!get_field("field_515d933e4347c", "options")) {update_field("field_515d933e4347c", 50, "options");}
      //...etc
    }
    
    // When switching Theme Hook
    function myactivationfunction($oldname, $oldtheme=false) {
      // IF Theme options is not set, do set/update them when activating theme
      updateoptionkeys();
    }
    add_action("after_switch_theme", "myactivationfunction");

    For some reason this approach doesn’t seem to work with the latest v. of WP & ACF…

  • Thanks, Elliot. Really appreciate the quick response!

  • Hi @thoughtspacewebsites

    As for your second comment, do I refer support clients to pre written articles, yes, of course I do.

    I don’t believe I have treated you unfairly, sorry If I have.

    Many support clients ask before searching / reading. It is important for me to ask if they have read the article that seems to be what the original question is

  • This is incorrect:

    
     name="' . $field['name']['textarea_2'] . '" >'
    

    It should be:

    
     name="' . $field['name'] . '[textarea_2]" >'
    

    There is a major different between the 2

  • Hi @elliot,

    Here is the data from ‘postmeta’ table.

    a:11:{s:3:"key";s:19:"field_51f95d72c7c5a";s:5:"label";s:4:"Date";s:4:"name";s:4:"date";s:4:"type";s:11:"date_picker";s:12:"instructions";s:36:"Please select the date of your event";s:8:"required";s:1:"0";s:11:"date_format";s:3:"Ymd";s:14:"display_format";s:8:"dd/mm/yy";s:9:"first_day";s:1:"1";s:17:"conditional_logic";a:3:{s:6:"status";s:1:"1";s:5:"rules";a:1:{i:0;a:3:{s:5:"field";s:19:"field_51f846266fda1";s:8:"operator";s:2:"==";s:5:"value";s:6:"Events";}}s:8:"allorany";s:3:"all";}s:8:"order_no";i:4;}

  • Hi @dparadis

    This is possible by querying WP for the posts, then looping through them and rendering the ACF data.

    1. Query WP for a post type (product) – please consult google
    2. Loop through the posts
    3. For each post (product), render the ACF data as per normal.

    Here are some examples which will help:
    * http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/
    * http://www.advancedcustomfields.com/resources/getting-started/code-examples/

    Note: Within your loop, you can use a function called get_the_ID() to get the ID of the current post. Use this value to load the ACF data (second parameter of the_field / get_field)

  • Hi @RichB

    Thanks for the screenshot.

    Adding a select for the taxonomy is on the to-do and you can expect to see it soon.

    ACF contains a filter which you can use to modify the WP_Query args and filter the posts. You can read more here:
    http://www.advancedcustomfields.com/resources/tutorials/customize-the-relationship-field-list-query/

  • Hi Elliot,

    I’ve read this page multiple times. No references are made as to whether or not it’s physically possible to include the premium addons (separate downloads) with ACF Lite (a plugin added through the themes directory). It’s clear that licensing allows for it, but not the interaction that’s created. I see no definitive guideline as to how to incorporate a premium add on with ACF Lite anywhere. Please feel free to show me where this is written.

    Maybe I wasn’t clear enough. I’m trying to figure out how ACF premium addons interface with ACF Lite. Do I have to download the add on, install, set up my fields, and then export the PHP? Then, when one of my clients installs the theme, are they required to install the premium add on also? Should I include the add on in the theme folder?

  • Hi @aaronrobb

    Unfortunately I can’t be of much help on this one as I am not the developer of this add-on.

    Perhaps you could post this question on the github repo / wp plugin support forum?

  • There is a documentation article which covers exactly this:

    http://www.advancedcustomfields.com/resources/getting-started/including-lite-mode-in-a-plugin-theme/

    Not to be rude, but did you search before posting this question?

  • Hi @aldoreyes

    This is a bit of a tricky one, but is possible with some logic as such:

    1. Search the wp_postmeta table for any rows which have a value of $post_id

    2. Delete these rows!

    The database query will have to be a custom FIND sql statement, but this is easy to create thanks to the wpdb functions. You can read more about this here:

    http://codex.wordpress.org/Class_Reference/wpdb

  • 
    <?php
    $args = array( 'post_type' => 'speakers', 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );
    
    while ( $loop->have_posts() ) : $loop->the_post();
    	echo '<div class="entry-content">';
    		echo '<h2 class="speaker-name">';
    			the_title();
    		echo '</h2>';
    			
    			$attachment_id = get_field('field_name');
    			$size = "thumbnail"; // (thumbnail, medium, large, full or custom size)
    			$image = wp_get_attachment_image_src( $attachment_id, $size );
    			
    			
    			echo '<img src="' . $image[0] . '" />';
    			
    			echo '<span class="speaker-title">';
    				the_field('title'); echo ' / '; the_field('company_name');
    			echo '</p>';
    			
    			the_content();                    
    	
    	echo '</div>';
    
    endwhile;
    ?>
    

    Straight from the image field docs. Please read the docs

  • Hi @Patrik

    Thanks for the feedback. I understand the frustration but let’s clear a few things up:

    1. This support forum is a free service provided by me (Elliot Condon) to anyone who wishes to use it, paying customer or not.

    2. To ask me to work 7 days a week providing feedback is a bit much. I don’t ask that of you, and I never would.

    3. To simply log off means that come Monday morning, I would have 3 days worth of support tickets to address. Sorry mate, but I do want to have a life.

    I’m appreciative that you are a customer and user of the ACF plugin, but being a human being on the planet earth, I think I deserve my weekends to enjoy with family and friends.

    Thanks
    Elliot

  • Closing the ability to open a new support ticket during weekends is just silly. The internet does not close like a store or the old phone support. If you don’t want to see new questions during the weekend, there’s a simple solution for that: Log off. Turn off email notifications. It’s really simple.

    Now I – a paying customer – have to wait until Monday to ASK my question, instead of merely waiting for the answer.

Viewing 25 results - 20,901 through 20,925 (of 21,363 total)