Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Inside your page template you should add another WP_Query to retrieve your subpage data :

    
    $sub_page = get_field('your_page_field');
    
    $sub_page_query = new WP_Query('page_id='.$sub_page->ID);
    while( $sub_page_query->have_posts() ) : $sub_page_query->the_post();
    
    endwhile;
    
  • +100 for this as well. Was just googling to see if anyone had found a solution for this and found this thread. Desperately need this for a current project.

    Would be nice to simply have an option when creating the color picker field to choose HEX or RGBA format similar to how you can select options for how data is returned for images etc.

    Would think this should be a pretty quick fix for Elliot.

    Edit: For now I am just going to use a PHP function to do it: http://weblizar.com/convert-hex-code-rgb-code-php/

  • the users won’t be confused as to why they need to add the same image twice if they want it to be the featured image and be in the gallery.

    it is just a matter how you label that image-field and what description text you set, and that it is after the gallery-field.
    also user don’t had to re-upload image, he should just “re-select” a already uploaded image. if you only show images uploaded to that post (for gallery and for featured image) it should be no problem and not confuse,
    if gallery dont have 50+ images it will be also relative easy to use.

    but that my humble opinion, if you dont think so i have no problem with that

  • it depends on:

    • is it really necessary to use a image from that gallery
    • do you need to set a “special” Image
    • can it be the first image
    • a random one of the gallery
    • did it need to be failsave
    • how good are you at coding

    the most easy thing is for sure to have a additional Image field (not required) where user can select that image. (optional create a filter or savepost action to set WP featured image to that field)

    also easy would be to use the first image of the gallery when additional yes/no field after gallery is set to true.
    a little more difficult would be to get a random, or the last image of the gallery.

    possible but probably not failsave is to let user select or type the image countnumber. and use that if possible, else use first image.

    if you are good at coding:
    create a additional fieldtype that create a drop-down with image and filename out of the gallery (something that works like relationship but for gallery) probably done with js

  • For those that don’t use Rackspace Cloud sites…here is more detail on the timeouts and why they happen:

    http://www.rackspace.com/knowledge_center/article/connection-timed-out-error-message-1

    “The bottom line is that data must be sent back to the client’s browser to keep the connection alive. So regardless of what sort of processing a page is doing, it must return data frequently or the load balancer will assume the connection has been dropped and will forcefully terminate it. Put simply, there will be some limitations of the shared architecture of Cloud Sites that will not allow us to resolve all issues for all customers.”

  • thank you very much that now outputs and sorts – I do have a follow up question about sorting by date entered – I’ll post a new thread.

  • Might look at a plugin such as https://wordpress.org/plugins/relevanssi/ which can generate an index that includes all custom fields, do fuzzy matching, etc. In the configuration you can set it to look at all custom fields which should do what you’re looking for.

    By default the plugin will upgrade the built-in search, but you can also use it in custom searches/queries if you need to as well.

  • Looks like just a minor typo possibly. In your first <td> you’ll need to echo your values. Also, the permalink variable was not declared. Might try:

    
    if( $posts ):
        foreach( $posts as $post ):
    	$fww_title = get_the_title( $post->ID );
    ?>
    	   <tr>
    		<td><a href="<?php echo get_permalink( $post->ID ); ?>"><?php echo $fww_title; ?></a></td>
    		<td>test</td>
    		<td><?php the_field('player_gender', $post->ID); ?></td>
    		<td><?php the_field('player_level', $post->ID);  ?></td>
    		<td><?php the_field('player_city', $post->ID); ?>, <?php the_field('player_state', $post->ID); ?></td>
    		<td><?php the_field('player_phone', $post->ID); ?></td>
    		<td><?php the_field('player_email', $post->ID); ?></td>
               </tr>
         <?php endforeach; ?>
    <?php endif; ?>
    
  • I guess the ACF Pro forum is not a very good place to post questions. No one has even read this, much less answered it. :-/

  • Hello !

    I’m looking for the same thing..
    Thank a lot to this plug in which allow to create customised fields but now I have to include a Search Filter whith these field.
    I’m creating a website which allow users to add their own home in order to exchange them with other. So my wish is be able to set some parameters like price and type of house according to users and after be able to search by this parameter.
    Is that possible ?
    I’m looking at the plug in Search & Filter which says

    Works with Advanced Custom Fields

    But how can we do ?

    Thank a lot for your attention and sorry I’m French..

  • I updated the test site, followed your recommendation and I can confirm that the Jetpack Form shortcode does not work when inserted via an ACF field.

    The code used to display the ACF field is:

    <?php $wysiwyg = get_field('editor');
    if ( $wysiwyg ) {
    	the_field('editor');
    } else {
    	echo 'ACF field is empty';
    } ?>

    The shortcode used to display the Jetpack Form in both tests is:

    [contact-form to='[email protected]' subject='Shortcode Test 1'][contact-field label='Name' type='name' required='1'/][contact-field label='Comment' type='textarea' required='1'/][/contact-form]

  • Hi @elliot, no, I haven’t found a solution for this, other than to disable validation as I described in an earlier post. I don’t know if this is good or bad, but had to do it as the website, where run into this problem, is a training website, full of SQL like commands content.

  • would this work? :

    foreach( $repeater as $row ) {
    $testimonial_p = $row['testimonial'];
    $testimonial_h2 = $row['testimonial_header'];
    
    echo '<article><div class="entry-content testimonial">';
    echo '<p>' . $testimonial_p . '</p>';
    echo '<h2>' . $testimonial_h2 . '</h2>';
    echo '</div></article>';
    }
  • I was also looking to exclude some terms, and this filter seems to work for me:

    add_filter('acf/fields/taxonomy/query','my_taxonomy_query',10,3);
    function my_taxonomy_query($args, $field, $options){
      $args['exclude'] = array(8,11); //the IDs of the excluded terms
      return $args;
    }
  • add this or something similar to functions.php or your plugin
    <?php add_image_size( 'my_thumb', '160', '390', true );?>

    after that you can use your created size inside your layout-loop

    <?php 
    
    $images = get_field('gallery');
    
    if( $images ): ?>
        <ul>
            <?php foreach( $images as $image ): ?>
                <li>
                    <a href="<?php echo $image['url']; ?>">
                         <img src="<?php echo $image['sizes']['my_thumb']; ?>" alt="<?php echo $image['alt']; ?>" />
                    </a>
                    <p><?php echo $image['caption']; ?></p>
                </li>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>
  • Wanted to quickly follow up on this… while trying to debug on my end I enabled WP_DEBUG in the config file on the server but did not see any errors come up and then once I disabled (set it to false) and re-uploaded the config file, the issue outlined above seemed to have fixed itself. So I guess this can be marked as resolved?

  • Hmmm, a little research on the internet, it would play with the “get_posts”, like this:

    $args = array(
    	'post_type' => 'post',
    	'meta_query' => array(
    		array(
    			'key' => 'relationship_games',
    		)
    	)
     );
    $postslist = get_posts( $args );
    
    $myposts = get_posts( $args );
    foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
    	<li>
    		<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    	</li>
    <?php endforeach; 
    wp_reset_postdata();?>

    But the problem is that it shows me the link of the article are displayed where my list of games that are related.
    I would like to see a list of games added since my backend, as in my article itself…
    Thanks, cheers

  • Solved it with this: slideshowSpeed: [ “<?php the_field(‘set_carousel_speed’, ‘option’); ?>”]

    The complete code:

    // Initialize Slider
     
        function agencyclix_slider_initialize() { ?>
            <script type="text/javascript" charset="utf-8">
                jQuery(window).load(function() {
                    jQuery('.flexslider').flexslider({
                        animation: "slide",
    					animationLoop: true,
    					itemWidth: 283,
    					itemMargin: 0,
    					minItems: 1,
    					maxItems: 4,
    					move: 1,
    					touch: true,
    					pauseOnHover: true,
    					slideshowSpeed: [ "<?php the_field('set_carousel_speed', 'option'); ?>"]
                    });
                });
            </script>
  • I’ve actually managed to work this out myself. I used a different method, get_posts, and I also used meta_query to return an array and compare the page ID to the custom field. So my final code looked like this:

    <?php										$special_offers = get_posts(array(										    'post_type' => 'special_offers',										    'meta_query' => array(										        array(										            'key' => 'applies_to', // name of custom field										            'value' => '"' . get_the_ID() . '"',										            'compare' => 'LIKE'										        )										    )
    ));
    										
    if( $special_offers ): 										    foreach( $special_offers as $offer ): 										    // Do something to display the articles. Each article is a WP_Post object.
    									    	echo "<div class='special_offer'><h3>";										    echo $offer->post_title;  // The post title										    echo "</h3><span class='offer_text'>";											echo $offer->post_content;  // The post content											echo "</span></div>";
    										    endforeach;										endif;
    										
    ?>
  • QuietNoise, have you got those patched files handy. I tried editing manually but didnt have much luck

  • Hi @jgraup

    Perhaps your theme / plugin contains some pre_get_posts filters which are modifying ACF’s get_posts function?

    There has been a minor change to the acf_get_posts function in that it does not use get_post anymore, instead it only uses get_posts.

    This could explain how a filter may be altering the query args and preventing the correct data from being returned.

  • I just wanted to add that I’m also having this issue too.

    I have a repeater field with a tabbed option in a dropdown.

    I’ve even made the field NOT required, but it still fails on validation if you use the default option.

    To make it validate, I need to individually go through each field and switch them to something else and then back again.

    This is on a site with mutliple contributors, which is causing me all sorts of headaches. I can also confirm this only came about after updating from 5.1.8.

    Cheers!

  • I fixed the rule_match function operator for != matches. It was set to

    elseif ($rule['operator'] != "!="){

    Instead of

    elseif ($rule['operator'] == "!="){

    This now works for me:

    /*
    ACF POST PARENT
    */
    add_filter('acf/location/rule_types', 'acf_location_rules_types');
    function acf_location_rules_types( $choices ) {
        $choices['Custom Post Types']['cpt_parent'] = 'Custom Post Type Parent';
        return $choices;
    }
    add_filter('acf/location/rule_values/cpt_parent', 'acf_location_rules_values_cpt_parent');
    function acf_location_rules_values_cpt_parent( $choices ) {
    	$args = array(
    		'hierarchical' => true,
    		'_builtin' => false,
    		'public' => true
    	);
        $posttypes = get_post_types( $args );
    
        if( $posttypes )
        {
            foreach( $posttypes as $posttype ):
    
    			if( $posttype != 'acf' ):
    				$args = array(
    				'post_type' => $posttype,
    				'posts_per_page' => -1,
    				'post_status' => 'publish'
    				);
    				$customposts = get_posts( $args );
    				if ( $customposts  ) {
    					foreach( $customposts as $custompost ){
    						$choices[ $custompost->ID] = $custompost->post_title;
    					}
    				}
    			endif;
    		endforeach;
    	}
    
        return $choices;
    }
    
    //MATCH THE RULE
    add_filter('acf/location/rule_match/cpt_parent', 'acf_location_rules_match_cpt_parent', 10, 3);
    function acf_location_rules_match_cpt_parent( $match, $rule, $options ) {
    
    	global $post;
    	$selected_post = (int) $rule['value'];
    
    	// post parent
    	if($post) {
      	$post_parent = $post->post_parent;
      	if( $options['page_parent'] ) {
          	$post_parent = $options['page_parent'];
      	}
      	if ($rule['operator'] == "=="){
      		$match = ( $post_parent == $selected_post );
      	}
      	elseif ($rule['operator'] == "!="){
      		$match = ( $post_parent != $selected_post );
      	}
    	}
      return $match;
    
    }
  • ok here are my core hack updates to allow for wrapping of field groups and optional display of field group titles in front end forms

    usage:

    $args = array(
        wrap_field_groups' => false // don't wrap [default]
        wrap_field_groups' => true // wrap without title
        wrap_field_groups' => 'show_title' // wrap with title
    );
    acf_form($args);

    api-field.php
    line 474 – 480

    // ACF5 core hack BEGIN
    // are we opening or closing a field group?
    if( $field['field_group_wrap'] === true ) {
    	echo $field['value'];
    	return;
    }
    // ACF5 core hack END

    api-template.php
    line 1273 – 1275

    // ACF5 core hack BEGIN		
    'wrap_field_groups'		=> false,
    // ACF5 core hack END

    line 1386 – 1401

    // ACF5 core hack BEGIN
    // check for field group wrap
    if( !empty( $args['wrap_field_groups'] ) ){
    	$wrapper = array(
    			'field_group_wrap' => true,
    			'value' => '<div id="'.$field_group['key'].'" class="acf_form_field_group_wrap">'
    	);
    
    	if ( 'show_title' === $args['wrap_field_groups']) {
    		$wrapper['value'] = '<div id="'.$field_group['key'].'" class="acf_postbox acf_form_field_group_wrap">
    									<h3 class="acf_form_field_group_title">'.$field_group['title'].'</h3>';
    	}
    
    	$fields[] = $wrapper;
    }				
    // ACF5 core hack END

    line 1408 – 1416

    // ACF5 core hack BEGIN
    // check for field group wrap
    if( !empty( $args['wrap_field_groups'] ) ){
    	$fields[] = array(
    		'field_group_wrap' => true,
    		'value' => '</div><!-- end field group -->'
    	);
    }				
    // ACF5 core hack END
  • I never heard back about it, and for this project I just hacked plugin core and disabled updating (not the best move, but it needed to be done).

    There is a “Wrapper Attributes” field now that lets you specify a class (among other things) in the ACF pro plugin, but I haven’t checked to see if it adds the class when using the acf_form() function, and it is only available to each input, not the whole group. I also haven’t checked to see if anything has been added to make each field group output uniquely ID’d either, so maybe something like what I suggested has been added and I just don’t know about it.

    I like your suggestions too, and think that there are quite a few features that could be added on this front. I feel like this is probably one of the less used abilities of the plugin though, so I can understand why it wouldn’t get frequent feature updates. If it was available on github I wouldn’t mind making updates like these and submitting pull requests but I’m using the pro plugin.

Viewing 25 results - 17,051 through 17,075 (of 21,345 total)