Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • I’m getting the same error.

    “This page can’t load Google Maps correctly”
    https://cl.ly/db57f9276f93

    And then when I add either of the code snippets into functions.php I just get a Javascript error “Sorry! Something went wrong!”:
    https://cl.ly/09942378f46e

    The front end of the site says:
    “Google Maps Platform rejected your request. Invalid request. Invalid ‘q’ parameter.”

    Using Beaver Themer.
    I’ve tried every solution in the forums but nothing is working.
    Site was fine a few weeks ago – it’s a directory site – all old maps still work fine.
    I just can’t add any new ones.

  • It was working fine on my android os 8 (oreo) without breaking any sweat. I hope you find the solution you required. appvn apk download

  • Problem solved, something edit my query.

    Thanks

  • Thank you for your reply.
    I found that it works when adding the following event to “acf.validation events” on line 12847 of acf-input.js.

      acf.validation = new acf.Model({
    
        /** @var string The model identifier. */
        id: 'validation',
    
        /** @var bool The active state. Set to false before 'prepare' to prevent validation. */
        active: true,
    
        /** @var string The model initialize time. */
        wait: 'prepare',
    
        /** @var object The model actions. */
        actions: {
          'ready':  'addInputEvents',
          'append': 'addInputEvents'
        },
    
        /** @var object The model events. */
        events: {
          'click input[type="submit"]': 'onClickSubmit',
          'click button[type="submit"]':  'onClickSubmit',
          'click #save-post':       'onClickSave',
          'mousedown #post-preview':    'onClickPreview', // use mousedown to hook in before WP click event
          'submit form':          'onSubmit',
          'mousedown #custom-preview':    'onClickPreview' // Add New
        },

    However, I didn’t know how to add this process without changing the core file. (I know that filters model.filters exists, but I didn’t know how to write correctly.)
    How can I add events to acf.validation?

  • The data looks correct, the question is why? The only thing that I can think of is that the field key reference is wrong.

    After your code updates the field, what is the field key reference? Look at the meta key for the same post, you are looking for the one that has the same name but starts with an underscore. The value of this field will be something like “field_7777777”. Does this field key match the field key of the field you’re updating? Does this change when you re-updated the field by updating the post in the admin?

  • This is more than likely do to the number of users. You’re probably (only guessing) either exceeding time limists or exceeding memory limits. Or there could be some type of PHP error that’s causing the AJAX request to fail.

    You need to do some debugging and figure out what’s causing the issue. You’ll need to use error logging so you can see what’s happening during the AJAX request. https://codex.wordpress.org/WP_DEBUG

  • There is no perfect answer for this. Field naming is open to opinion.

    When I am creating fields I try to prefix them all with something to ensure uniqueness, but this is also based on the conditions.

    If I am building a plugin, the all field names have what I hope is a unique prefix.

    If I’m building a site that will only be used for one client, then this usually does not happen. In this case, when it is appropriate, I use a prefix that matches what the fields are for. For example, if I am building a product sections then all the fields will be prefixed with something like product_ or prod_ if I want to keep it short.

    Custom fields must be unique for the WP object they are attached to. All of the fields for a single Post must be unique. Any fields for a single Term must be unique. All Options fields must be unique. The exception to this are sub fields of any type. sub fields are automatically prefixed with the parent’s (and grandparent’s, all ancestors’) field name. This makes them unique if the top level parent field is unique.

    As far as changing field names. There is no way to safely change a field name and update all of the fields in all locations with the new name. Changing field names will cause the data to become disconnected. This is no different than any standard WP meta_key.

  • I will add more accurate information.
    Added custom preview button with reference to https://rudrastyh.com/wordpress/fullscreen-preview-button.html. Custom preview buttons worked without problem until ver 5.6.
    When updating to version 5.7, clicking the button will reload the page.
    How can I solve it?

    // functions.php
    add_action('acf/input/admin_enqueue_scripts', 'my_enqueue_scripts');
    function my_enqueue_scripts()
    {
      global $pagenow;
    
      if ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
        wp_enqueue_script('custom-preview', get_template_directory_uri() . '/js/custom-preview.js');
      }
    }
    
    // custom-preview.js
    (function($) {
      acf.addAction('load_field/type=flexible_content', function() {
        $(document).on('click', '#custom-preview', function(e) {
          e.preventDefault();
          $('#post-preview').click();
        });
      });
    })(jQuery);
    
  • Auto Solved 🙂
    This is the code that can serve others if they have the same problem

    
    <?php 
    
    //take relationship field of this doctor
    		
    $location= get_field('location');
     if( $location):
     foreach( $location as $l ):
    		
    //array of post type doctor and take the post with key location and compare with the ID of location of this doctor $l->ID
    
    		$doctors = get_posts(array(
    		'post_type' => 'doctor',
    		'posts_per_page' => '-1',
    		'post__not_in' => [get_queried_object_id()],
    		'meta_query' => array(
    		array(
    		'key' => 'location', // name of custom field
    		'value' => $l->ID, // the ID of this doctor
    		'compare' => 'LIKE'
    		)
    		)
    		)); 
    		
    	?>
    
    	<?php if( $doctors ): ?>
    	<?php foreach( $doctors as $doctor ): ?>
    
    //
    	
    <div class="col-md-2">						
     <a href="<?php echo get_permalink( $doctor->ID ); ?>">
    
       <img src="<?php echo get_the_post_thumbnail_url( $doctor->ID ); ?>">
       <h2><?php echo get_the_title( $doctor->ID ); ?></h2>
    </a> 
    </div>
    	<?php endforeach; ?> //second foreach
    	
    	<?php endif; ?> //second if
    	
    	<?php endforeach; ?> //first foreach
    	
    	<?php endif; ?> //first if
    	
    
    
  • I have managed to show ACF field on “Add Product” page for WC Vendors.

    This is the code I have got from WC Vendor’s support forum.

    and just bit of modification in the hook, instead of add_action(‘wcvendors_settings_after_shop_name’, ‘wcv_save_acf_fields’); hook I used add_action('wcvendors_after_product_form' to save the form. and to display field original code : add_action(‘wcvendors_settings_after_seller_info’, ‘wcv_add_acf_fields’); and I have replaced it with add_action('wcv_after_product_details' to display it on Add product page. The full code is below:

    /*
     *- Courtesy of Ben Lumley -
     * https://www.wcvendors.com/help/topic/howto-add-acf-fields-to-frontend-shop-edit/
     *
     * https://docs.wcvendors.com/knowledge-base/adding-advanced-custom-fields-acf-support/
     *
     * This will display + save any custom fields applicable to the vendor_shop in question.
     * Second one displays the fields, you can adjust the action it’s attached to in order
     * to move the fields (see templates/dashboard/store-settings.php in the pro plugin for
     *  possible actions). You could also split and display different fields in different
     * places – see the docs for acf_form, you can select single/groups of fields.
     * http://www.advancedcustomfields.com/resources/acf_form/
     * Also possible via acf_form to alter the markup a bit to make it fit your theme.
     *
     * This code is not supported by WC Vendors, use at your own risk and at your own discretion.
    */
    
    add_action('wcvendors_after_product_form', function () {
        acf_form_head();
    });
    
    add_action('wcv_after_product_details', function () {
    
        acf_form(
            [
                'post_id' => 'user_' . get_current_user_id(),
                'form' => false,
                'return' => false
            ]
        );
    
    });

    the field shows now, but the problem is it’s not saving the ACF value. any idea why it is not saving 🙁

  • Ah, found the answer.
    Solution: Run a nested query. First one returns all the related posts, already sorted. Collects them in an array and for the second query you can use ‘post__in’ => $idArray, ‘orderby’ => ‘post__in’ in the $args.

  • I should mention what I am really trying to do here is have a way to display upcoming and past events separately for events that are assigned to a specific post. This seems to be working for me:

    <?php
    	$today = date( 'Ymd' );
    	$post_ids = get_field('seminars', false, false);
    
    	$posts = get_posts(array(
    		'post_type' => 'any',
    		'posts_per_page'	=> -1,
    		'post__in'	=> $post_ids,
    		'meta_key'       => 'event_date',
    		'meta_compare'   => '>=',
    		'meta_value'     => $today,
    	));
    
    	if( $posts ) {
    		?>
    		<ul>
    			<?php foreach( $posts as $post): ?>
    				<?php setup_postdata($post); ?>
    				<li class="line">
    					<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    					<?php the_excerpt(); ?>
    				</li>
    			<?php endforeach; ?>
    		</ul>
    		<?php wp_reset_postdata(); ?>
    		<?php } ?>
  • Hey @hube2

    Thanks for your help here. I am just touching back on this now. I put my repeater and date fields in the two specified areas, along with the_title in the loop area so my code looks like this:

    <?php // get relationship field without formatting
    // returns an array of post ID values
    $posts_ids = get_field('seminars', false, false);
    // do your own query to order the posts
    $args = array(
      'post_type' => 'any',
      'posts_per_page' => -1,
      'post__in' => $post_ids,
      'meta_query' => array(
        'date_clause' => array(
          'key' => 'event_time',
          'value' => 'EXISTS'
        ),
      ),
      'orderby' => array('date_clause' => 'ASC');
    );
    $custom_query = new WP_Query($args);
    if ($custom_query=>have_posts()) {
      while ($custom_query=>have_posts()) {
        $custom_query=>the_post();
        the_title();
      }
    }
    wp_reset_postdata();
    ?>

    However I get a php error at this line:
    'orderby' => array('date_clause' => 'ASC');

    [08-Oct-2018 14:29:58 UTC] PHP Parse error: syntax error, unexpected ‘;’, expecting ‘)’ in /home/clientname/public_html/wp-content/themes/mytheme/template-parts/content-attorney.php on line 182

    I’ve been playing find the syntax error with no luck. Anything glaringly obvious to you?

  • That example shows how to add 2 filters

    
    // array of filters (field key => field name)
    $GLOBALS['my_query_filters'] = array( 
    	'field_1'	=> 'city', 
    	'field_2'	=> 'bedrooms'
    );
    

    My understanding of this code is that you just need to add more fields to this list to add additional filters. It may requires modifying code for each filter depending on what field type the acf field is. For an overview on the correct meta query for different fields types https://www.advancedcustomfields.com/resources/query-posts-custom-fields/

  • This reply has been marked as private.
  • Thank you so much,

    That worked at first try!

    I do have a feeling I could have made the code more efficient. Setting variables twice?

    Or is it correct right now. (it works 😉 )

    <?php
    					
    $queried_object = get_queried_object();
    $taxonomy = $queried_object->taxonomy;
    $term_id = $queried_object->term_id;
    					
    					
    add_action('pre_get_posts', 'uitgelichte_cursusloop_land');
    function uitgelichte_cursusloop_land($query) {
      if (is_admin() || !$query->is_main_query()) {
        return;
      }
      if ($query->is_tax($taxonomy )) {
        $query->set('meta_key', 'uitgelicht_bij_land');
        $query->set('meta_value', '1'); 
        $query->set('posts_per_page', 30);
      }
    }
    					
    // The Query
    $the_query = new WP_Query(  
    	array( 
    		'post_type' => 'cursus', 
    		'posts_per_page' => 30,
    		'meta_key' => 'uitgelicht_bij_land',
    		'meta_value' => '1', 
    	'tax_query' => array(
      	array(
        'taxonomy' => $taxonomy,
        'terms' => array($term_id)
      )
    )
    	) 
    	); 
    
    // The Loop
    if ( $the_query->have_posts() ) {?>
     <h3>Uitgelichte taalcursussen in <?php single_term_title(); ?></h3>
     <?php while ( $the_query->have_posts() ) {
        $the_query->the_post();
       get_template_part( 'cursusloop', get_post_format() );
      }
    } else {
      // no posts found
    }
    /* Restore original Post Data */
    wp_reset_postdata(); ?>
  • I have the same issue – also trying to order by a custom date field. So the code looks almost identical. I have orderby written correctly but still have this issue.
    I’ve also tried ‘orderby’ => ‘meta_value’ and ‘orderby’ => ‘meta_value_num’ with no difference.
    My args are:

    $args = array(
    ‘post_type’ => array( $post_type ),
    ‘post_status’ => array( ‘publish’ ),
    ‘posts_per_page’ => -1,
    ‘tax_query’ => array(
    array (
    ‘taxonomy’ => $taxonomy,
    ‘terms’ => $term_id,
    )
    ),
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘date’,
    ‘compare’ => ‘>=’,
    ‘value’ => $date_now,
    ‘type’ => ‘DATETIME’
    ),
    ),
    ‘order’ => ‘DESC’,
    ‘orderby’ => ‘meta_value’,
    ‘meta_key’ => ‘date’,
    ‘meta_type’ => ‘DATETIME’,

    );

    I’d be grateful if you have any pointers 🙂

  • <?php
    $args = array(‘post_type’ => ‘fhb_news’, ‘posts_per_page’ => 3);
    $loop = new WP_Query($args);
    while ($loop->have_posts()) : $loop->the_post();
    ?>
    <div class=”modal-content modal-content-styling”>
    <div class=”datum”>
    <?php the_date(‘scheduled_date’); ?>
    </div><h3><?php the_title(); ?></h3>
    <div class=”Anreissertext”><?php the_content(); ?></div>
    <div class=”weitereinfos-startseite”>
    <div id=”myModal-<?php the_id(); ?>” class=”modal fade out” role=”dialog” style=”display: none;” aria-hidden=”true”>
    <div class=”modal-dialog modal-dialog-styling”>
    <!– Modal content–>
    <div class=”modal-content modal-content-styling”>
    <div class=”modal-header modal-header-styling”>
    <div class=”col-12″>
    <div class=”lightbox-caption”>
    News-Details
    <button type=”button” class=”close lightbox-close” data-dismiss=”modal” aria-label=”Close”>
    <span aria-hidden=”true”>×</span>
    </button>
    </div>
    </div>
    </div>
    <div class=”modal-body modal-body-styling”>
    <div class=”row”>
    <div class=”col-12 col-md-7″>
    <div style=”margin-left:2%;” class=”h2-in-lightbox”>
    <?php the_field(‘news_detail_title’); ?>
    </div>

    <div style=”margin-left:2%;” class=”text-in-lightbox”>
    <?php the_field(‘news_detail_beschreibung’); ?>
    </div>
    </div>
    <!–Side box Title–>
    <div class=”col-12 col-md-5″>
    <div class=”col-12″>
    <?php if (get_field(‘sideboxtitle’) && get_field(‘news_download’)) { ?>
    <div class=”Ort-Kasten-unten”>
    <div class=”h1-Kasten”><?php the_field(‘sideboxtitle’); ?></div>

    <?php $file = get_field(‘news_download’); ?>
    “>Marktbericht (PDF)
    “>
    </div>
    <?php } ?>
    <!–_____Side img__________–>
    <?php
    $image_url = get_field(‘sideimg’);
    ?>
    <?php if (isset($image_url)) { ?>
    <div class=”container”>
    <div class=”row”>
    “>
    </div>
    </div>
    <?php } ?>

    Ihave this code would like to pagination i have tried all my efferot can any one help me

  • <?php
    $args = array(‘post_type’ => ‘fhb_news’, ‘posts_per_page’ => 3);
    $loop = new WP_Query($args);
    while ($loop->have_posts()) : $loop->the_post();
    ?>
    <div class=”modal-content modal-content-styling”>
    <div class=”datum”>
    <?php the_date(‘scheduled_date’); ?>
    </div><h3><?php the_title(); ?></h3>
    <div class=”Anreissertext”><?php the_content(); ?></div>
    <div class=”weitereinfos-startseite”>
    <div id=”myModal-<?php the_id(); ?>” class=”modal fade out” role=”dialog” style=”display: none;” aria-hidden=”true”>
    <div class=”modal-dialog modal-dialog-styling”>
    <!– Modal content–>
    <div class=”modal-content modal-content-styling”>
    <div class=”modal-header modal-header-styling”>
    <div class=”col-12″>
    <div class=”lightbox-caption”>
    News-Details
    <button type=”button” class=”close lightbox-close” data-dismiss=”modal” aria-label=”Close”>
    <span aria-hidden=”true”>×</span>
    </button>
    </div>
    </div>
    </div>
    <div class=”modal-body modal-body-styling”>
    <div class=”row”>
    <div class=”col-12 col-md-7″>
    <div style=”margin-left:2%;” class=”h2-in-lightbox”>
    <?php the_field(‘news_detail_title’); ?>
    </div>

    <div style=”margin-left:2%;” class=”text-in-lightbox”>
    <?php the_field(‘news_detail_beschreibung’); ?>
    </div>
    </div>
    <!–Side box Title–>
    <div class=”col-12 col-md-5″>
    <div class=”col-12″>
    <?php if (get_field(‘sideboxtitle’) && get_field(‘news_download’)) { ?>
    <div class=”Ort-Kasten-unten”>
    <div class=”h1-Kasten”><?php the_field(‘sideboxtitle’); ?></div>

    <?php $file = get_field(‘news_download’); ?>
    “>Marktbericht (PDF)
    “>
    </div>
    <?php } ?>
    <!–_____Side img__________–>
    <?php
    $image_url = get_field(‘sideimg’);
    ?>
    <?php if (isset($image_url)) { ?>
    <div class=”container”>
    <div class=”row”>
    “>
    </div>
    </div>
    <?php } ?>

    Ihave this code would like to pagination i have tried all my efferot can any one help me

  • Just tested this while at work, and it was exactly what I was looking for! Elegant, clean, and without compromise. I had seen the “conditional logic” button, but never checked into it. If I did, it definitely didn’t use to be as powerful as it is now. Thanks for the quick answer, this already powerful tool just got that much better for me.

  • if all you want to show on this page is the featured posts and the rest of the posts in the term will never be shown then instead of doing a custom query on the page you need to use a pre_get_posts filter and alter the query that WP is already doing.

    
    add_action('pre_get_posts', 'your_function_name_here');
    function your_function_name_here($query) {
      if (is_admin() || !$query->is_main_query()) {
        return;
      }
      if ($query->is_tax('your-taxonomy-here')) {
        $query->set('meta_key', 'uitgelicht_bij_land');
        $query->set('meta_value', '1'); 
        $query->set('posts_per_page', 3);
      }
    }
    

    If on the other hand you are showing other posts as well then you do need to do a custom query, but you need to add a tax_query. You can get the current taxonomy like

    
    $queried_object = get_queried_object();
    $taxonomy = $queried_object->taxonomy;
    $term_id = $queried_object->term_id;
    

    then you can use these values in the tax query

    
    'tax_query' => array(
      array(
        'taxonomy' => $taxonomy,
        'terms' => array($term_id)
      )
    )
    
  • This seems to work, might be a bit bloated for now, but it is working properly

    <?php 
    		
    if(have_rows('featured_solutions')){
    	
    	while (have_rows('featured_solutions')) {
    		the_row();
    		
    		$featured_sol = get_sub_field('featured_solution');
    		if($featured_sol){
    			
    			$fsolimage = get_field('page_thumbnail', $featured_sol->ID);
    			$fsollink = get_permalink($featured_sol->ID);
    			$fsoltitle = get_the_title($featured_sol->ID);
    			//$fsolsizes = get_field('product_size' , $featured_sol->ID);
    			//$pipesize = get_sub_field('pipe_size' , $featured_sol->ID);
    			//$fsoapproval = get_sub_field('approval' , $featured_sol->ID);
    			//$fsolapprovals = get_field('product_approval' , $featured_sol->ID , $fsoapproval[0]);
    			
    		}
    		
    			
    		
    		
    		echo '<div class="solutionItem">
                    <div class="siImage" style="background-image:url(' . $fsolimage . ');"><h3 class="">' . $fsoltitle . '</h3></div>
                    <div class="siPad">
                        <div class="siCopy">
                            <div class="siTop">
                                <span>Applications</span>
    							<p>';
                                $categories = wp_get_post_categories( $featured_sol->ID , array('child_of' => 10 ));
    							//loop through them
    							foreach($categories as $c){
    							  $cat = get_category( $c );
    							  //get the name of the category
    							  $cat_id = get_cat_ID( $cat->name );
    							  //make a list item containing a link to the category
    							  $applications = $cat->name;
    							  echo $applications. '<br />';
    							}
                           echo '</p>
    						</div>
                            <div class="siLeft">
                                <span>Sizes</span>
    							<p>';
                                if(get_field('product_size' , $featured_sol->ID)){
    								while(has_sub_field('product_size' , $featured_sol->ID)){
    									echo the_sub_field('pipe_size' , $featured_sol->ID) . '<br />';
    									}
    								}
                            echo '</p>
    						</div>
                            <div class="siRight">
                                <span>Approvals</span>
    							<p>';
                                if(get_field('product_approval' , $featured_sol->ID)){
    								while(has_sub_field('product_approval' , $featured_sol->ID)){
    									echo the_sub_field('approval' , $featured_sol->ID) . '<br />';
    									}
    								}
                            echo '</p>
    						</div>
                            <div class="breakline"></div>
                            <div class="siCTA">
                                <div class="ctabutton primary"><a href="' . $fsollink . '">learn more</a></div>
                            </div>
                        </div>
                    </div>
                </div> ' ;
    		
    	}	
    	
    } 
    ?>
  • Thanks for all the quick replies. Still no luck, though.

    Removing the standard meta boxes is what the code in my first post was doing (provided it was correct code). I do have to say, though. The taxonomy meta boxes did not appear in the first place, until I used the following code in my functions file.

    function kw_add_tags_to_attachments() {
        register_taxonomy_for_object_type( 'post_tag', 'attachment' );
    }
    add_action( 'init' , 'kw_add_tags_to_attachments' );

    This is what adds the standard textbox that just takes the slug. But I removed this once I started working with the ACF taxonomy fields.

  • John,

    That is exactly what I did -I updated the ACF plugin, then updated the add-ons repeater and flex, and then the database. After doing those steps in that sequence all of my Field Groups disappeared. I am using the free version of ACF. I upgraded from Version 4.4.12 to 5.7.6 and running Word Press 4.9.8. How can I roll back???

  • I would like that an option of a select is checked by clicking on a button (via jQuery). Is it possible to do it?

Viewing 25 results - 9,101 through 9,125 (of 21,340 total)