Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Thanks for your replies!

    It will be a great feature if you include it in the future.

    Meantime, I have managed with a text field, where the client manually types different dates, separated by commas (which later will appear in an array inside a jquery script)

    Thanks again,
    Victor

  • I tried another approach – I get all posts and than I filter those that is right into one array and all others into another array. Is in fact better for my purposes. I have this code:

    $arenden = new WP_Query( $args );
    if ( $arenden->have_posts() ) : 
        while ( $arenden->have_posts() ) : $arenden->the_post();
    $utfors_av = get_field('utfors_av');
    $utfors = reset($utfors_av);
    
        if($utfors == $user_id) {
            array_push( $idmina, get_the_ID() );}
        endwhile;
    endif;
    ?>

    The $args is just the standard, $idmina is the array I have setup were I want to store the IDs. But when I use this, I get an error:
    Warning: reset() expects parameter 1 to be array, boolean given in ../archive-arenden.php on line 42 Line 42 is $utfors = reset($utfors_av).

    When I use this on line 42 instead:
    $utfors = strstr($utfors_av, ',', true);
    I get another error saying it is an array.
    Warning: strstr() expects parameter 1 to be string, array given in /home/almewebb/alpnet/wp-content/themes/enterprise-pro/archive-arenden.php on line 42

    So what do I do wrong. Surely something trivial that I don’t see.

  • Hi, thank you for your response..
    I tell you what you ask me..
    My custom post type is ‘pacchetto’ and i have two group for each post type. One for the wordpress posts: Articoli and one for my custom post type: pacchetti
    I want a query with CPT’s posts ‘pacchetto’ in sigle.php where return the posts when fields ‘zona_per_gli articoli’ = ‘zona-per-i-pacchetti’
    I use the follow code:

    <?php
    $zone_articoli = get_field('zona_per_i_pacchetti');
    $args = array(                      
            'post_type' => 'pacchetto',                                   
            'meta_query' => array(
                    'key' => 'zona_per_gli_articoli',
                    'value' => $zone_articoli
                );
    $loop = new WP_Query($args);
    while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <div> 
    <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    </div>
    <?php endwhile; wp_reset_postdata();?>

    This code return me all posts from CPT ‘pacchetto’ and not filtering with fields. I think because i am in single.php and there are a rules for each post type
    In effect if i write
    echo $zone_articoli it return the effective value, but if i write

    $zone_pacchetti = get_field('zona_per_gli_articoli');
    echo $zone_pacchetti; 

    don’t work (no value).
    This last code work in single-pacchetto.php
    I think i must merge the location rules for make my query with my fields…
    Thank you so much!

  • I’m not sure what I’m doing wrong: http://colbyblogs.org/wptest/custom-post-types/shortcode/

    On this page I’m using a plugin called CSS & Javascript Toolbox to inject PHP code on my page, if you look at the source code the img tag isn’t working right with the code I took from your help pages:

    <img src="<?php the_field('field_name'); ?>" alt="" />

  • Hi elliot – thank you so much! Amazing support here!

    Note: these changes should also be made to the right side of the UI on line 495, although a little different:

    changing:
    $title .= $p->post_type;

    To:

    $post_type_object = get_post_type_object( get_post_type( $p ) );
    $title .= $post_type_object->labels->singular_name;

    And also in the “select”, where you can select a posttype. Current code looks like this around line 451:

    foreach( $field['post_type'] as $post_type )
    	{
    	$choices[ $post_type ] = $post_type;
    	}

    Im not completely sure what the best way would be here, as i don’t quite understand the acf filters.

    But that should then fix it for this field, i think. Im impressed with the quick response!

  • For “media modal window” I mean the default modal-box that WordPress show when a user have to upload a image or a file in a post. The same that the Gallery Field show when I click the “upload image” blue button.

    If I select a pre-existing image in Media the gallery works and display them right in the admin and in the front-end.
    If i upload a new image, it is correctly uploaded and show in the gallery-field box BUT when I save the post or when i update the post… the last uploaded image disappear and the pre-existing images remain correctly in the gallery.

    I see that the new image is correctly uploaded in the website, i can see it in the Media section.

    The field have unique name, and it work for long time until now.
    Other ACF for the same post-type works great.

    The unique major change I made in the website is enable WPML.

    Any ideas?

  • I am doing this inside a template (archive). I updated my code with WP_Query

       <?php    $user_id = get_current_user_id();
       echo $user_id;?>
        
        <?php $$args = array(
       'post_type' => 'arende',
       'meta_key' => 'utfors_av',
       'post_status'       => 'publish',
       'posts_per_page'    => -1,     
       'order' => 'ASC',
       'meta_query' => array(
           array(
               'key' => 'utfors_av',
               'value' => $user_id, //array
               'compare' => '=',
           )
       )
     );
     $query = new WP_Query($args);;?>

    But this returns the same result as mine did before.

  • Hi @thesrpr

    If you reduce 200 down to 50, does this fix the issue? It is possible that your server can’t handle querying 200 posts at once.

    Thanks
    E

  • Also, I just noticed you are performing a meta_query, not a normal WP query.

    I think you need to create a WP_Query that contains a meta_query param.

    Thanks
    E

  • Hi @ramon

    Please check that your $ids array is correct by debugging it like so:

    
    <?php echo '<pre>';
    	print_r( $ids );
    echo '</pre>';
    die; ?>
    

    Looking at your code, it seems to be a jumble of WP_Query and get_posts.

    Please keep to 1 consistent style like so:

    
    <?php 
    
    $ids = get_field('relacionado', false, false);
    							
    $the_query = new WP_Query(array(
    	'post_type'      	=> 'produtos',
    	'posts_per_page'	=> 3,
    	'post__in'			=> $ids,
    	'post_status'		=> 'any',
    	'orderby'        	=> 'rand',
    ));
           
    
    // The Loop
    if ( $the_query->have_posts() ): 
    
    	while ( $the_query->have_posts() ): $the_query->the_post();
    		
    		?>
    		<div>
    		    <img src="<?php echo get_field('imagem_chamada'); ?>" alt="">
    			<h2><a href="<?php the_permalink() ?>" title="" rel="bookmark"><?php the_title() ?></a></h2>
    			<p><?php echo get_field('chamada'); ?></p>
    		</div>
    		<?php
    		
    	endwhile;
    
    endif;
     ?>
    

    It is possible that you don’t even need to use a custom WP_Query at all. Have you tried looping over the results from get_field('relacionado')?

    Thanks
    E

  • Hi @Boniz

    Can you please explain what you mean by:
    ‘It disappear both in the Gallery Field metabox and in the “Media modal window” view!’ – what is ‘it’?

    Do you have any other fields on the page which are saving to the same field name as your gallery field’s?

    perhaps you could try renaming your gallery field to something unique to test this?

    Are any other ACF fields saving correctly?

    Thanks
    E

  • Hi @smrubenstein

    Thanks for your feature request. Currently ACF uses the native search found in the WP_Query parameter.

    To search the_content, you can always hook into the relationship args and customize the query yourself.

    I don’t want to add any custom search functionality to this field due to the interface not showing the highlighted ‘search terms’.

    Thanks
    E

  • two things to try:

    1. firstly, for fun, comment out the $args = array('ppp'=>200); and see if you can just go through the filter with no changes. if not, find the errors, they are either in your javascript console or hiding in your error log (in local do you have wp_debug set to true?)
    2. next, and this may be what you try first if you are querying a particular field, try to be more specific by filtering only the field that you need to filter like this: acf/fields/relationship/result/name={$field_name}

    if you have multiple fields to query against, i wonder if you can dogpile them:

    
    add_filter('acf/fields/relationship/name=title', 'tdr_carousel_query', 10, 3);
    add_filter('acf/fields/relationship/name=keywords', 'tdr_carousel_query', 10, 3);
    add_filter('acf/fields/relationship/name=description', 'tdr_carousel_query', 10, 3);
    
  • 
    function tdr_carousel_query( $args, $field, $post )
    {
        $args = array(
            'posts_per_page' => 200
        );
     
        return $args;
    }
    add_filter('acf/fields/relationship/query', 'tdr_carousel_query', 10, 3);
    

    no on screen errors. just when you start typing in the search box nothing happens. When I remove the above code it works just fine.

    Production and local

  • Hi @anarita

    Currently, WP does not provide a termmeta table, so a meta query cannot be performed on a term query.

    What I would do is load all terms from the ‘project’ taxonomy, then loop over them and load in the ‘client’ for each one using the get_field function.

    You can then simply compare the value, and continue the loop to avoid it, or display the project data if a match was found.

    Thanks
    E

  • This reply has been marked as private.
  • Hi @pastore1980

    Your question is quite hard to understand. Can you please provide a clearer explanation of what you are trying to do?

    Please name your CPT instead of saying I have one custom post type.

    Also, please refrain from such broad and vague terminology like this:
    Now i want use the value of field from custom type (with a new wp-query loop) in single.php

    I can tell you that the get_field function can be used WITHIN a custom WP_Query loop.

    What code are you using? Perhaps you can post it (please wrap in backticks – code button)

  • Hi @tuhin

    Thanks for your concern. All servers have a limit of how many PHP variables can be used at one time, and how big an array variable can be.

    Your repeater field is perhaps the larges I have ever seen, and this field was not intended to be used in this manor.

    ACF does not contain a limit, but PHP does. It is possible to increase this max_vars limit and PHP memory like so:
    http://www.advancedcustomfields.com/resources/faq/losing-data-save/

    Thanks
    E

  • Hi @tomjhume

    Using get_sub_field within this load_field filter will not work.

    The get_sub_field function MUST be used within a have_rows while loop.

    Perhaps there is more to your question that originally mentioned?
    What are you trying to do? What is your data setup?

  • Hi @advancedcustomfields@swell.nl

    This is a limitation of the WP_Query args.
    If you were to add the status to the meta_query array, then it too would be treated as an ‘OR’.

    It seems that you can’t mix ‘AND’ with ‘OR’ in a meta_query.

    You may need to first find all the posts using the meta_query you have, then loop over the results and remove (unset) the ones which don’t have the correct ‘status’ meta_value.

    Thanks
    E

  • Only on the front end.

    I’m using the gallery add-on which I purchased purely for the front-end ability to batch upload photos with the standard media upload UI. The gist of the rest of process (which is working):

    • ACF adds a select field to event post type that is populated with Gravity Forms for admin to select which registration form to use. That is displayed on upcoming events via template.
    • Create a CPT for galleries
    • ACF provides meta fields on gallery (eventID, photographer, email and multi-photo from add-on.

    The last piece is having the ACF form show up on event to allow batch upload of photos which is limited by the issue described above.

    I have a temporary workaround of putting a separate the photo submission form onto a separate page that populates the eventID via select field populated with past dated events. But requirement is that everything stays tied to the individual event along with comments, post-event feedback (GF) form.

  • Hi @Exelmans Graphics

    Thanks for the feature request, however a link can not be placed within a select field. Furthermore, this would not be possible to position the edit button above the select field due to the multi-select fields scroll ability.

    This feature will not be able to make it into the current version, but I will consider adding it in the future if new technology is available.

    Thanks
    E

  • Hi @vaggogol

    A Multi-select field requires you to hold shift, or cmd to select multiple items, much like using finder to select multiple files.

    Thanks
    E

  • Hi @navitronic

    Thanks for the info. The issue here is that upon clicking a taxonomy term, ACF fires an AJAX request to find field groups based on the current post.

    For some reason, it seems that the data being posted is not correct and causing the wrong field groups to be returned. This is causing the field group to hide.

    Can you provide a login account for me to test?

    Thanks
    E

  • could you post your query?

    also, the result which is indicate by your search being termed broken will help; for instance, do you receive any on screen errors?

    is this a development environment or a live environment, do you have wp_debug turned on?

Viewing 25 results - 18,826 through 18,850 (of 21,364 total)