Support

Account

Forum Replies Created

  • Hi Johan,

    I think you’ll have to do a loop of your repeater first. Create a new multidimensional array variable which’ll hold each year as a key and an array of the fields as values. Then loop through that instead.

  • Hi @joverbey,

    There’s some clarification needed here.
    First of it seems you’re not actually talking about category pages but rather regular pages in wordpress (you’re querying page post_type).
    Second, why are you not simply putting these images in the respective child page? Maybe even as featured image since that seems to be what you want it to be used as.

    Some other notes that may be good to know:
    * Don’t use query_posts. You’ll only be messing with the main query in a bad way. Instead create a new query with wp_query. https://codex.wordpress.org/Class_Reference/WP_Query
    * Try to avoid inline styling of elements. Put this in your style.css instead
    img{ max-width: 100%; height: auto; }

  • Yeah 🙂

    It’s an easy function to miss as it looks so much alike the others. But I’m glad I could help! Be sure to really scan the available functions/actions/filters in the documentation before attempting something hacky, there’s actually quite a bit there!

  • You’re welcome and good luck!

    My guess is that there’s more elements using the same class but perhaps only one link. So this might work too
    $('a.acf-repeater-add-row').click();

    Just as a note 🙂

  • Hi,

    you can disable the ability to see the media library in the upload modal by checking this box
    prevent media library in upload

  • I don’t have any benchmarking on testing with and without ACF JSON sync but it’d be very interesting to see the difference..

    If/when this is fixed and you do make a switch it’d be very nice if you post your results for us to see 🙂

    Another way to go about this for you (if you’re in pressing need) might be to:
    * Update to ACF 5
    * Create the acf-json folder in the theme
    * Import all the fields into field group admin
    * Delete the php fields
    * Use the JSON files for your version control etc. instead of continuing on php. Alternatively continue using PHP too but for live -pushes make sure to import them into field group admin first and skip pushing/uploading the php files to Prod.

  • I agree with you but I’m not sure how one would tackle this. It’d be one thing if there was a way to manually trigger a revision save but there doesn’t seem to be one (from my findings).

    Let me know if you find such a way, then we’d be able to actually do something about it!

  • Hi Harry,

    Glad to hear ACF is helping you out 🙂

    I see what you mean here and my only concern is wether it is possible with the way oembed works in WordPress at the moment.

    The oembed field is actually really simple. All it does (for the actual oembed part on frontend) is that it returns the value from wp_oembed_get() which is a WordPress core function.

    My concern is that rather than it being ACF not recognising an url with ?rel=0 it’s the WP Core function. And since it doesn’t take any other arguments than width and height (apart from the url to embed) custom controls for this in ACF couldn’t do anything.

  • Hi @oppodeldoc

    Actually update_sub_field does not have the ability to create new rows in a repeater or flexible field. It can only update existing sub fields

    However I’ve posted a solution here which you should be able to use to figure this out: http://support.advancedcustomfields.com/forums/topic/create-new-repeater-row-from-front-end-form/

    Good luck and let me know if that doesn’t do it for you 🙂

  • Hi Chris and Benjamin,

    ACF uses the select2 library for the fancy ajax dropdowns.
    Can you make sure that you don’t have any other plugins loading the select2 library on front end?

    Also make sure that the version loaded on your frontend is 3.5.1.

  • Hi @metropolis

    get_image is not an ACF function (or WP function). Do you mean that using get_field on an image field has this result?

  • Hi @robmehew

    Could you try using WordPress sanitize_text_field() function to do the sanitation just to make sure there’s nothing outside of ACF giving you this “error”. https://codex.wordpress.org/Function_Reference/sanitize_text_field


    @tadywankenobi
    that is weird indeed. So the variable $new is definitely an array all the time? You haven’t declared $new somewhere else as well or use the same field_name for a different meta field on the same post? And the value you’ve set for the checkbox is “set”?

    Also, you can try instead of a checkbox field to use a true/false field since that’s pretty much what you want.. It’ll return either true or false (1/0 .. duh 😉 ).

  • Hi @florian

    Have you taken a look inside the JSON file to make sure the export is getting everything with it?

    Also you could post your export code here (or maybe preferably on pastebin or something) so I can take a look 🙂

  • Hi Jason,

    I actually think you can make this a lot easier on yourself.
    Instead of having three queries (inside an empty and completely unnecessary loop) you can probably do a single query and order the results based on your meta data. Luckily in the alphabet it goes L – M – S 😉

    Here’s a very refactored code I think should do the trick for you (you might need to set the order parameter too). I haven’t tested this live.

    
    <section id="content">
    	<section id="featured">
    		<div class="row">
    		
    			<?php 
    			// args
    			$args = array(
    				'post_type' => 'post',
    				'meta_key' => 'homepage_size',
    				'orderby' => 'meta_value',
    			);
    			 
    			 // query
    			$the_query = new WP_Query( $args );
    			
    			?>
    
    			<?php if( $the_query->have_posts() ): ?>
    				<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
    					
    					<?php 
    					$size = get_field('homepage_size');
    					$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
    					$image_style = ( $image ? "background-image: url('" . $image[0] . ");" : '' );
    					
    					if( $size === 'large' ){
    						$classes = 'col-md-6 col-sm-6 col-xs-12 post featured-' . $size;
    					}else if( $size === 'medium' ){
    						$classes = 'col-md-6 col-sm-6 col-xs-12 post featured-' . $size;
    					}else{
    						$classes = 'col-md-3 col-sm-3 col-xs-12 post featured-' . $size;
    					}
    					
    					?>
    		
    					<div class="<?php echo $classes; ?>" style="<?php echo $image_style; ?>">
    						<div class="post-content">
    							<div class="category">
    								<?php $categories = get_the_category(); foreach($categories as $category) { $cat_name = $category->name; if($cat_name != 'featured') echo '<a href="'.get_category_link($category->term_id).'">'.$cat_name . '</a> '; } ?>
    							</div>
    							
    							<div class="clearfix"></div>
    					
    							<header class="title">
    								<a href="<?php the_permalink(); ?>">
    									<h1><?php the_title(); ?></h1>
    									<h2><?php the_field('subtitle'); ?></h2>
    								</a>
    							</header>
    						</div>
    					</div>
    					
    				<?php endwhile; ?>
    			<?php endif; ?>
    			<?php wp_reset_postdata();	 // Restore global post data stomped by the_post(). ?>
    		</div>
    	</section>
    </section>
    
  • Hello everyone,

    I’ve come across the need for RGBA myself too at times so I’m with you there.


    @herrfischer
    s link to a third party plugin should do well until this is implemented. As far as implementation goes it’s not as easy as you would think.
    ACF is using WordPress Core Color picker called Iris. Iris supports many different color types (?) but unfortunately not RGBA (it does support RGB tho).

    There’s a lot of requests for this feature on Iris github repo (https://github.com/Automattic/Iris) but so far the author has yet to implement it and doesn’t seem to like the forks people have done. So to support this in ACF Elliot would either have to switch to a different color picker (meaning another script to load in admin) or wait for it to be implemented in core.

    I would suggest using the third party plugin until then 🙂

  • Hi @geoff-grav,

    I just started working the forums so hopefully you won’t have to go on a bump-frenzy anymore. We’re now a few people that will support you guys.

    I’m not sure wether this should fall on ACF or WP Core. Triggering revisions saving in an edit-post screen is done by WP Core and it would seem it does not react to the creation of new input fields (not so strange).

    I’m not sure there’s a possibility to even trigger revisions manually? That’d be a necessity if ACF would take a stab at it.

    Have you tried this plugin? I haven’t looked at it closely but perhaps it does what you want: https://github.com/adamsilverstein/wp-post-meta-revisions

  • Hi @geoff-grav,

    It’s a good suggestion and I’m almost a little surprised it’s not already been done. Elliot probably hasn’t thought of it since both PHP and JSON solutions make it possible to version-control fields etc. One would have to figure out priority so that JSON is preferred to php based on a timestamp (just like DB vs JSON is).

    I’ll make sure Elliot sees this thread 🙂

    However I’m not sure why you can’t move to ACF5 anyway? If JSON storage is the only reason you still don’t have it in ACF4.x so moving to ACF5 would just mean better stuff for you and eventually (hopefully) a working php > JSON relationship. Upgrading is also completely non destructive so should something break you can just switch back to ACF4.x without loosing any data (But always do a backup anyway).

  • Hi Brian,

    There are location rules in ACF with which you can make sure a group of fields are only visibly to an administrator.

    Location rules for admin only fields

    Personally I think that if one has time this is a perfect situation to code your own super simple Meta box. But you can also use a message field (which is obviously just read only) and modify it’s output to show your view count as plain text.

  • No problem @cdiscla

    glad it worked out fine! I hope it’s just formatting of the posting that makes your end quotation mark different (it would probably break the code).

  • Hi @bmds,

    Since localstorage is Javascript-based you don’t really have much choice but to read the localstorage data and create new rows and insert the values.

    Since it’ll be very hard for you to replicate how the rows are structured I’d recommend just triggering the “add row” button with JS thus letting ACF do the creation.

    Something like:

    
    jQuery('.acf-repeater-add-row').trigger('click', function(){
    
    //Delay a function a few hundred millseconds to give ACF time to create the row then do your own insertion. Preferably via function call
    setTimeout(insertLocalstorageData,500)
    
    });
    
    function insertLocalstorageData(){
    //Do stuff!
    
    }
    
  • Hi Steve,

    You can’t do what you’re asking just by modifying the wp_query with pre_get_posts.. Atleast not by querying artwork.

    However, you can instead of directly querying artwork and trying to order those query the artists.
    So you would do a custom wp_query for all artists and order them by their lastname like so:

    
    $args = array(
    'post_type' => 'artist',
    'orderby' => 'meta_value',
    'meta_key' => 'surname',
    'posts_per_page' => -1
    );
    

    Then as you loop through each artist you query their artwork (inside the artist loop).

    
    $artist_ID = get_the_ID();
    $artwork_args = array(
    	'post_type' => 'artwork',
    	'posts_per_page' => -1,
    	'meta_query' => array(
    		array(
    			'key' => 'artist_dropdown',
    			'value' => $artist_ID,
    			'compare' => '='
    		)
    	)
    );
    
  • Hi,

    Yes this is absolutely possible and it’s not even validation. It’s more about limiting the datepickers depending on each other..

    I’ve done exactly this myself but on a front end ACF form so I’m certain it works.
    Good luck!

  • Hi,

    So to be clear this is happening when you have a custom taxonomy field mapping the terms to the post?
    I’m sure Elliot will be on it since @jcml has opened a support ticket about it.

  • Hi @groberts

    Yes ACF isn’t a querying motor in any way really so sure, anything you can do with wp_query you can use ACF for. Everything else and as advanced as that query you’ll have to do it yourself.

    Feel free to mark your second post as the answer so we know this topic is closed 🙂

  • Hi,

    As of later versions of ACF you do not need to use that filter in order for a new post to be created.

    Instead you use the new_post parameter of acf_form.

    See the section under “Create a new post” here: http://www.advancedcustomfields.com/resources/acf_form/

Viewing 25 posts - 726 through 750 (of 1,019 total)