Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Not quite what I meant.

    What I need to be able to do is get the first five rows of a repeater, repeat the first five rows of that repeater in a different format, then do the next five rows and repeat the next five rows in a differetn format.

  • Solved my issue.

    I added data attributes to the marker HTML:
    <div class="marker" data-type="<?php echo $map_display_setting; ?>" data-zoom="<?php echo $map_zoom_level; ?>" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>"></div>

    And then set global variables:

    		var marker = $('.marker');
    			var zoomLevel = marker.data('zoom');
    			var mapType   = marker.data('type');

    And then altered the code below:

    		// vars
    		var args = {
    			zoom		  : zoomLevel,
    			center		: new google.maps.LatLng(0, 0),
    			mapTypeId	: google.maps.MapTypeId[mapType]
    		};

    and

    		// only 1 marker?
    		if( map.markers.length == 1 )
    		{
    			// set center of map
    		    map.setCenter( bounds.getCenter() );
    		    map.setZoom( zoomLevel );
    		}
  • <?php
    $count = 0;
    $your_repeater = get_field('your_repeater');
    if($your_repeater){
       while( have_rows('your_repeater') ): the_row();
       $count++;
       $my_field = get_sub_field('my_field');
       echo '<div class="row">'.$my_field.'</div>';
       if ($count == 6) {
          echo '<div class="somecontent">getcontent6</div>';
       }
       if ($count == 12) {
          echo '<div class="somecontent">getcontent12</div>';
       }
       if ($count == 18) {
          echo '<div class="somecontent">getcontent18</div>';
       }
       if ($count == 24) {
          echo '<div class="somecontent">getcontent24</div>';
       }
    endwhile;  
    }
    ?>

    with that code every 6 row your additional row with content is added

  • <?php
    $count = 0;
    $your_repeater = get_field('your_repeater');
    if($your_repeater){
       echo '<div class="headerrow">header</div>';
       while( have_rows('your_repeater') ): the_row();
       $count++;
       $my_field = get_sub_field('my_field');
       echo '<div class="row">'.$my_field.'</div>';
       if ($count % 5 == 0) {
          echo '<div class="specialrow">subheader</div>';
       }
    endwhile;  
    }
    ?>

    with that code every 5 row a additional row is added (always the same)
    if you need each 5 row totally different code, replace
    if ($count % 5 == 0) with if ($count == 5) and add a if-loop for each additional 5 rows

  • i cant say how you add this with a filter.
    but i can offer a workaround if you dont use core content-WP-wysiwyg (anyway or are able to dont use it.)
    if you meet this requirement than look at my post inside this thread
    with that “workaround” you should be able to find everything that you save like that with core-search, because you use searchable core as hidden placeholder. 😉

  • maybe just a stupid question:
    would it work if the column name of featured is lowercase?
    $column_featured = array( 'featured' => 'Featured' );

    and at frontend:
    did this code works?

    if(get_field('featured')) {
    echo 'Yes';
    } else {
    echo 'No';
    }
  • Whilst certainly no expert, I couldn’t get the_field to work in a WP-Query, so I used this instead:

    
    $name = get_post_meta(get_the_ID() , 'your_name', true); //custom field

    then just echo $name

  • For anybody who is interested. made a simple tag field for ACF on the frontend, in which you can add taxonomies as required.

    You can find it here. It is very simple but it works. It will display a field where you can enter comma separated values, which then get saved or updated to your selected taxonomy (tags) (non hierarchical).

    https://github.com/kolhoffmmm/acf_tags

  • Hi, I’ve got similar troubles, but it seems I’m running into ‘max_execution_time’-error.
    As I’m hard pressed to get the value changed on that server, I’d like to know, if there is any chance to do this update ‘bit by bit’ or something like that.

    And I’d like to suggest that the update script should at least show some (meaningless) error-message if the returned ajax isn’t what it should be – an endlessly spinning gif is not really helpful.

    Edit: I managed to get the max_execution_time temporarily raised to 10min and that worked. But I had a lot of of doubled field-groups (quintupled actually) from the earlier tries. And I even had doubled fields in some of them. After deleting those everything seems to work fine, but still that wasn’t a very pleasant experience.
    To be fair, I do love ACF and it still is a great plugin, but somehow this upgrading process should be optimized.

  • Not sure if this helps, but I’m doing something similar, and I just created a quick multi-dimensional array which maps the field keys and the values from my form on the front-end to the proper variables, then I can use a loop. I’m using Gravity Forms, but here’s some (brief) sample code:

    //Map the Custom Field Keys
    $selections['furnace']['key'] = 'field_5181b4065293c';
    $selections['ac']['key'] = 'field_5181c655cb339';
    $selections['filter']['key'] = 'field_5181c6e3cb33d';
    	
    //Map the values to the proper entry vars
    $selections['furnace']['value'] = $entry['1'];
    $selections['ac']['value'] = $entry['2'];
    $selections['filter']['value'] = $entry['3'];
    		
    //See if there is any previously saved data, and save the new values
    foreach ($selections as $snippet=>$item) {
    			
    	if (strlen($item['value'] > 1)) { //Don't need to do anything unless we have a value to save
    			
    		//We don't care in this case if there was a previous value; we always replace it with any passed data
    		update_field( $item['key'], $item['value'], $post_id );
    	}
    }
  • <div class="carousel fade-carousel slide" data-ride="carousel" data-interval="4000" id="bs-carousel">
      <!-- Overlay -->
      <div class="overlay"></div>
      
    <ol class="carousel-indicators">
     <?php 
    $i=0;
    while( have_rows('slideshow_images') ): the_row();
    if ($i == 0) {
    echo '<li data-target="#bs-carousel" data-slide-to="0" class="active"></li>';
    } else {
    echo '<li data-target="#bs-carousel" data-slide-to="'.$i.'"></li>';
    }
    $i++;
    endwhile; ?>
    </ol>
     
      <!-- Wrapper for slides -->
      <div class="carousel-inner">
     <?php 
     $z = 0;
     while( have_rows('slideshow_images') ): the_row();
       $image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); ?>
    
        <div class="item slides <?php if ($z==0) { echo 'active';} ?>">
      
        <div style="background: url(<?php the_sub_field('image'); ?>);max-height:500px;height: 100%; background-size: cover; background-position: center center; background-repeat: no-repeat;"></div>
          <div class="hero" style="width:96%;">
            <hgroup>
                <h1><?php the_sub_field('title');?></h1>        
                <h3><?php the_sub_field('sub_title');?></h3>
            </hgroup>
            <a href="<?php the_sub_field('image_links_to'); ?>"<button class="btn btn-hero btn-lg" role="button"><?php the_sub_field('links_to_text'); ?></button></a>
          </div>
        </div>
    <?php 
    $z++;
    endwhile; ?>    
      </div>
    </div>

    try if this works.

    PS: i cant see private post from 28feb, and please edit first post (look that every tag is closed “forum tags”, not inside php code, specially li and ul/ol to get rid of layout-prob inside this thread)

  • Hi

    Many thanks for your response, I think I have it working now lease see below code is this correct?

    <?php while ( have_posts() ) : the_post(); ?>
    <?php the_field('locations' ); ?>
    <section class="section-light-grey text-center">
    	<div class="container">
    		<div class="row">
    			<?php if( have_rows('locations_repeater') ): ?>
    			<?php while ( have_rows('locations_repeater') ) : the_row(); ?>
    			<div class="col-xs-4">
    				<div class="img-home-location">
    					<a href="<?php the_sub_field('image_link'); ?>">
    						<img src="<?php the_sub_field('location_image'); ?>" alt="" class="img-responsive" />
    					</a>
    					<h3><?php the_sub_field('location_title'); ?></h3>
    				</div>
    			</div>
    			<?php endwhile; ?>
    			<?php endif; ?>
    		</div>
    	</div>	
    </section>
    
    <?php endwhile; ?>
  • I have the same question. Is there any way to create a revision point by changing a post with acf via front-end form?

  • I’m having this issue with my Repeaters as well in ACF5. I think Elliot’s question of how much HTML and JS is on the page could be correct.

    I’ve got a page with only 57 repeater rows. Each repeater has some conditional logic resulting 9400 lines of HTML. 1600 lines of that is TinyMCE and the Media Library scripts.

    Has anyone else made any progress on finding a solution for this?

  • I have the images and all text showing up using the repeater sub fields now.

    The slider show’s only one slide (the first slide only).

    I’m thinking it has something to do with the indicators and the counter for the indicators. I don’t know if I have that part properly formatted.

    Here’s the code:

    <div class="carousel fade-carousel slide" data-ride="carousel" data-interval="4000" id="bs-carousel">
      <!-- Overlay -->
      <div class="overlay"></div>
      
    <ol class="carousel-indicators">
     <?php while(the_repeater_field('slideshow_images')): ?>
    <?php $i = 0 ?>
    <?php 
    if ($i == 0) {
    echo '<li data-target="#bs-carousel" data-slide-to="0" class="active"></li>';
    } else {
    echo '<li data-target="#bs-carousel" data-slide-to="'.$count.'"></li>';
    }
    $i++
    ?>
    
    </ol>
    
      <!-- Wrapper for slides -->
      <div class="carousel-inner">
     
      <?php $z = $z + 1; $image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); ?>
    
        <div class="<?php echo ($z==1) ? 'item slides active ' : ''; ?>item slides">
      
        <div style="background: url(<?php the_sub_field('image'); ?>);max-height:500px;height: 100%; background-size: cover; background-position: center center; background-repeat: no-repeat;"></div>
          <div class="hero" style="width:96%;">
            <hgroup>
                <h1><?php the_sub_field('title');?></h1>        
                <h3><?php the_sub_field('sub_title');?></h3>
            </hgroup>
            <a href="<?php the_sub_field('image_links_to'); ?>"<button class="btn btn-hero btn-lg" role="button"><?php the_sub_field('links_to_text'); ?></button></a>
          </div>
        </div>
      </div>
    <?php endwhile; ?>
    
    </div> 
  • I did this recently by splitting them up into multiple field groups. The first group is a taxonomy radio field. Then I have several other field groups which are conditional based on the taxonomy of the pgae. Here’s a quick video of what I mean. http://cl.ly/1s302Z3k2p1i

  • Hi, I’m trying to use this feature also. I have a simple form group with 3 fields that I want displayed when users are being created or edited based on a specific role being chosen.

    I just purchased pro the other day and 2/27/2015 and I’m on v5.1.9.1 of the pro plugin.

    The fields show up successfully on edit of a user but not on role selection while creating a user.

    My location rules are very simple:

    – User Role is equal to Agent

    No other rules, and like I said, it shows up perfectly when editing an existing user just not on creation. Please let me know if I’m doing something wrong here. Also please let me know if you need any further information.

    Thanks,

    Alan

  • I was able to fix this issue using this source:
    http://support.advancedcustomfields.com/forums/topic/querying-database-for-repeat-sub-fields-displaying-revisions/

    on another note: would it be possible to sort it now by meta_id? so that every added image shows up first in stead of last?

    regards!
    M

  • ok: i’ve come this far.

    I used the script for Querying the database for repeater sub field values. I deleted the meta_value part because i dont have a meta value, i only have the thumbnails (the value is the path to the thumbnail). So it should view all images used in the sub field thumbnail in the repeater gallery_repeat.

    It shows all images, but in multiple numbers.. (it shows the one repeater 3 times, the other one 5 times, …)

    this is my code: (source: http://www.advancedcustomfields.com/resources/querying-the-database-for-repeater-sub-field-values/ )

    <?php
    
    	// get all rows from the postmeta table where the sub_field (type) equals 'type_3'
    	// - http://codex.wordpress.org/Class_Reference/wpdb#SELECT_Generic_Results
            $rows = $wpdb->get_results($wpdb->prepare( 
                "
                SELECT * 
                FROM wp_postmeta
                WHERE meta_key LIKE %s
                ",
                'gallery_repeat_%_thumbnail' // meta_name: $ParentName_$RowNumber_$ChildName
               
            ));
    
    	// loop through the results
    	if( $rows )
    	{
    		foreach( $rows as $row )
    		{
    			// for each result, find the 'repeater row number' and use it to load the image sub field!
    			preg_match('_([0-9]+)_', $row->meta_key, $matches);
    			$meta_key = 'gallery_repeat_' . $matches[0] . '_thumbnail'; // $matches[0] contains the row number!
    
    			//  use get_post_meta to load the image sub field
    			// - http://codex.wordpress.org/Function_Reference/get_post_meta
    			$image_id = get_post_meta( $row->post_id, $meta_key, true );
    
    			// load image src
    			// - http://www.advancedcustomfields.com/resources/field-types/image/
    			$src = wp_get_attachment_image_src( $image_id, 'full' );
    
    			?>
    			<div class="item">
    				<img src="<?php echo $src[0]; ?>" />
    				<p class="wp-caption-text">From 
    					<a href="<?php get_permalink( $row->post_id ); ?>">
    						<?php echo get_the_title( $row->post_id ); ?>
    					</a>
    				</p>
    			</div>
    			<?php
    
    		}
    	}
    
    	?>

    and a screenshot to show how it looks now:
    screenshot

    As you can see, it shows multiple identical images. in my thumbnails theres only one per repeater (all unique).
    It looks like it should be an easy fix, but my knowledge does not reach this far. Would help me out greatly if this was resolved!

    edit: ive noticed that everytime i edit the post, a dublicate of the image is made for some reason…

    regards,
    Mathieu

  • The latest version now works with ACF5, qTranslate Plus and qTranslate-X.

  • I can confirm the bug was not present in 5.1.7.1 .
    For a travel agency web site I have two nested repeaters (Room Type > Prices) so that they can insert prices for double room, triple room, etc and for several dates for each room type.

    The price repeater has conditional logic to show the price field only for the selected room type; it worked perfectly till yesterday, when I updated to 5.1.9.1 .
    Now every time I try to save a post, I get an error stating that 6 fields are missing (e.g. if I typed values for double room prices, the missing fields are for single, triple and quadruple room price).

    Fortunately I was able to downgrade to 5.1.7.1 from a backup.

  • Same here with 5.1.9.1 very annoying when you are doing a demo for a customer… Quick fix please ! 🙂

  • +1 this is a required feature, tags are supposed to be added, as it is a non hierarchical taxonomy.

  • I was having a lot of trouble with this as well, especially with the attached images. Here is what I ended up with:

    <?php 
      $rows = get_field('partners'); 
      if($rows) $i = 0; { 
        shuffle( $rows ); 
        foreach($rows as $row) { 
          $i++; if($i==6) break; 
          $image = $row['partner_logo']; ?>
    
          <li class="partners-list-item desaturate"><img src="<?php echo $image; ?>" alt="" /></li>
    <?php } } ?>
    
  • did it works when you do this:
    delete $model_pic = "<?php get_field('model_photo'); ?>";
    and add $model_pic = get_field('model_photo'); after global $post;

    but i know it is possible

Viewing 25 results - 17,126 through 17,150 (of 21,345 total)