Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Hi Eliot,
    My problem was that I was using the [value] in the template -which was returned from the key. Problem solved by using:

    $field = get_field_object('selling_points');
        $points = get_field('selling_points');
        foreach ( $points as $point ){
           $label = $field['choices'][ $point];
           echo '<li class="bullet-item">'.$label.'</li>';
        }
    }

    (My thanks to Micheal on your support staff)

  • Hi @Elliot,
    Thanks for your reply.
    Of course, I understand this was beyond the the use of ACF, but I thought I’d just give it a shot anyway, as I saw that use of ACF forms was mentionned on the forum & that these topics seemed remotely related …

    About breaking the subjet into separate tasks: my thoughts exactly, so I would start by asking myself how to query & test an ACF CPT field from the front end (this obviously would require that I have a frontend widget constructed, installed & declared, and this IS outside the scope 🙂 )

    Any hint on this particular task, as my starting point.

    And again many thanks for your continued interest in other people’s issues !
    regards,
    JM

  • Thanks Elliot.

    I ended up wrapping the contents of the foreach with a conditional, and it seems to have done the trick.

    foreach( $rows as $row )
    	{
    	if ( get_post_status($row->post_id) == 'publish' ) :	
    		preg_match('_([0-9]+)_', $row->meta_key, $matches);
    		$name_key = 'awards_' . $matches[0] . '_award-name'; // $matches[0] contains the row number
    		$year_key = 'awards_' . $matches[0] . '_award-year';
    
    		$award_name = get_post_meta( $row->post_id, $name_key, true );
    		$award_year = get_post_meta( $row->post_id, $year_key, true );
    		echo '<li><span class="award-name">'. $award_name .'</span>, <span class="award-yeaer">'.$award_year.'</span></li>';
    	endif;
    	}
  • Hi @janwbouma

    you can use the filter here to modify the $args used to display relationship field results. http://www.advancedcustomfields.com/resources/filters/acf-fields-relationship-query/

    you can add in a parent argument (please read the WP_Query docs before hand)

    Thanks
    E

  • Hi @jmb

    This will require some very custom code which is a bit beyond the scope of this community forum.

    Perhaps you should think about the task and break it down into individual tasks that you can understand step by step.

    Then work on these smaller tasks one by one.

    Cheers
    E

  • Hi @bluecomet

    You can achieve this by using the WP_Query object.

    To search, you can simply provide a value for s.

    To limit the results to those related via a relationship field, please read this guide:
    http://www.advancedcustomfields.com/resources/tutorials/querying-relationship-fields/

    Thanks
    E

  • Hi @Speedy-one

    ACF does not come standard with a a time picker field, so I can’t provide support for a 3rd party developed field type.

    In regards to it being a sub field, you can have a look here as to using sub fields in a WP_Query args:
    http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/#example-5

    Thanks
    E

  • Hi @marksmits

    Currently ACF does not support menu items.

    Thanks for your request, this will be looked at in the near future.

    Cheers
    E

  • Gotcha, thanks for responding. If I get a free moment before you get a chance to do anything with it I’ll slap together a variation using slug and send you the code. In a dev -> staging -> production environment term ID is likely to get out of sync while term slug you have some degree of control over, espec. if you preface them in a consistent and unique way (ie: dojo-some-term-slug).

    Cheers!

  • Hi @JustRunLah

    Can you please read over the date field documentation and query posts articles?

    These will provide a good starting ground for you to write this custom query / template.

    Thanks
    E

  • Hi @exeQutor

    Global options are possible using the options page add-on.
    You can see it in action here:
    http://www.advancedcustomfields.com/add-ons/options-page/

    Thanks
    E

  • Hi @mindgames

    Your first query will find all mobiles, correct?
    If you want to list the total mobiles in each category, you can simply loop over your results and load the mobile category.

    Then use this category to increase a counter like so:

    
    $counter = array(
    'android' => 0
    );
    
    // start loop over posts
    $category = 'xxx';
    $counter[ $category ]++;
    // end loop over posts
    
    //output
    echo 'android total = ' . $counter['android'];
    

    Hope that helps.

    Thanks
    E

  • Thank you @elliot and @matiasvad for the quick reply’s.

    I will work to drop this into the child theme, and I am sorry for my stubbornness but I would like to ask a couple of follow up questions.

    If the prepend/append is not stored in the DB, then how does the prepend/append store information to display the prepend/append on the back end?

    Secondly, If this cannot be displayed on the front-end, then what is the purpose of the prepend/append? — Is it to assist in filling in the form? Can you send an example of the uses?

    I was having trouble finding this in the documentation.

    Thank you guys so much, and again I am sorry if I sound like I am complaining because I am not. I beyond grateful for all that you do and for ACF.

    Thank you again.

  • 
    public function pre_populate_teams_dropdown( $field ) {
    	$field['choices'] = array();
    
    	$apollo_home_args = array(
    		'post_type' => 'teams',
    		'nopaging' => true,
    		'fields' => 'ids',
    	);
    
    	$apollo_home_teams = new WP_Query( $apollo_home_args );
    
    	if( $apollo_home_teams->have_posts() ) :
    		while( $apollo_home_teams->have_posts() ) : $apollo_home_teams->the_post();
    			$field['choices']['Apollo'][$post] = get_the_title( $post );
    		endwhile;
    		wp_reset_postdata();
    	endif;
    
    	$apollo_away_args = array(
    		'post_type' => 'opponents',
    		'nopaging' => true,
    		'fields' => 'ids',
    	);
    
    	$apollo_away_teams = new WP_Query( $apollo_away_args );
    
    	if( $apollo_away_teams->have_posts() ) :
    		while( $apollo_away_teams->have_posts() ) : $apollo_away_teams->the_post();
    			$field['choices'][__( 'Opponents', 'apollo' )][$post] = get_the_title( $post );
    		endwhile;
    		wp_reset_postdata();
    	endif;
    
    	return $field;
    }

    Appears to work as well.

  • Hello Elliot,

    I changed it to:

    publicic function pre_populate_teams_dropdown( $field ) {
    	global $post;
    	//var_dump( $post );
    	$field['choices'] = array();
    
    	$apollo_home_args = array(
    		'post_type' => 'teams',
    		'nopaging' => true,
    	);
    
    	$apollo_home_teams = get_posts( $apollo_home_args );
    
    	if( count( $apollo_home_teams ) > 0 ) :
    		foreach( $apollo_home_teams as $team ) {
    			$field['choices']['Apollo'][ $team->ID ] = get_the_title( $team->ID );
    		}
    	endif;
    
    	$apollo_away_args = array(
    		'post_type' => 'opponents',
    		'nopaging' => true,
    	);
    
    	$apollo_away_teams = geT_posts( $apollo_away_args );
    
    	if( count( $apollo_away_teams ) > 0 ) :
    		foreach( $apollo_away_teams as $team ) {
    			$field['choices']['Apollo'][ $team->ID ] = get_the_title( $team->ID );
    		}
    	endif;
    
    	return $field;
    }

    This works, however it strikes me as odd. The function get_posts uses WP_Query too and the wp_reset_postdata() filter makes sure the $post variable is restored. So somehow the $post variable isn’t reset the way it should.

  • Hi @sixfootjames

    Thanks for the request. I’ll try to find some time to put together some more demos.

    Basically, the options page is the same idea as a ‘theme settings’ page. It is an area that data can be updated and is not attached to a specific post.

    Cheers
    E

  • Hi @holly73

    This is quite a complicated scenario to which I don’t have an answer.
    You would need to load all your events, and the ‘recurring dates’ for each. With all this data, you could append it into an array.

    With this array of dates, you could then populate the event calendar.

    I hope helps.

    Thanks
    E

  • One quick way that comes to mind is to implement a counter (of course there may be many other ways):

    <?php $images = get_field(‘image_gallery’);
    if( $images ) { 
    $counter = 0;
    ?>
    <div id=”imagegallery”>
    
    <?php
      foreach( $images as $image ) {
        if ( $counter == 0 ) {
          echo 'first image';
        else {
          echo 'all other images';
        }
        $counter++;
     }
    ?>
    
    </div>
    <?php } ?>
  • Hi, I’ve just tried to code above and it seems to work perfectly

    One quick question I show my featured image as a large product image then have the others as thumbnails in a gallery

    Is there a way to exclude the featured image from the returned gallery results?

    This is the code I’m using to display the gallery

    Thanks

    Lee

    <?php $images = get_field(‘image_gallery’);
    if( $images ) { ?>
    <div id=”imagegallery”>

    <?php foreach( $images as $image ) { ?>

    ” alt=”<?php echo $image[‘alt’]; ?>” class=”alignleft” />

    <?php } ?>

    </div>
    <?php } ?>

  • Ok I figured it out:

    
    <?php
    
    $posts = get_field('venue');
     
    if( $posts ): ?>
        
        <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
            <?php setup_postdata($post); ?>
            <?php $vmap = get_field('venue_google_map', $post->ID); ?>
            <div class="acf-map">
    	  <div class="marker" data-lat="<?php echo $vmap['lat']; ?>" data-lng="<?php echo $vmap['lng']; ?>"></div>
    	</div>
        <?php endforeach; ?>
        <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    <?php endif; ?>
    
  • Heya!

    This is the output:

    acf.fields.wysiwyg.toolbars = {
        "full": {
            "theme_advanced_buttons1": "bold,italic,strikethrough,bullist,numlist,blockquote,justifyleft,justifycenter,justifyright,link,unlink,wp_more,AtD,fullscreen,wp_adv",
            "theme_advanced_buttons2": "formatselect,underline,justifyfull,forecolor,pasteword,removeformat,charmap,outdent,indent,undo,redo,wp_help,code",
            "theme_advanced_buttons3": "",
            "theme_advanced_buttons4": ""
        },
        "basic": {
            "theme_advanced_buttons1": "bold,italic,underline,blockquote,strikethrough,bullist,numlist,justifyleft,justifycenter,justifyright,undo,redo,link,unlink,fullscreen"
        }
    };
  • Hi @exeQutor

    Can you please download the latest ACF from github. There are some JS fixes for tab + conditional logic issues.

    Let me know if this solves your problem.

    Thanks
    E

  • Hi @YourMark

    Because your filter is creating a new WP_Query object, and using the function $apollo_home_teams->the_post();, the global $post will be over written.

    The best solutions is to not use WP_Query, but instead, use the get_posts function and loop over the results like an array.

    Thanks
    E

  • Hi @rpk

    Thanks for the request. Can you please describe how these functions would be used and where?

    Thanks
    E

  • Hi @Will

    Thanks for the question.

    Currently, ACF does not have the ability to insert before / after other plugins during the attachment fields filter.

    Perhaps this is something that I can look at in the future, but for now you will need to manually adjust the priority of the attachment_fields_to_edit filter.

    Thanks
    E

Viewing 25 results - 18,651 through 18,675 (of 21,364 total)