Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Hi !
    I find this solution with query !
    This code work perfectly.

    ` $sidebar = get_field(‘sidebar-widget’);
    $args = array(
    ‘post_type’ => ‘sidebar-widget’,
    ‘page_id’ => $sidebar
    );
    $query = new WP_Query( $args );
    // The Loop
    ?>
    <?php if($query->have_posts()) : ?>
    <?php while($query->have_posts()) : ?>
    <?php $query->the_post(); ?>
    <?php include(‘widget/content-sidebar-widget.php’); ?>
    <?php endwhile; ?>
    <?php wp_reset_postdata(); ?>
    <?php endif; ?>`

  • Hello @elliot,
    thanks for your attention!

    the console ajax error responses are shown in the image below:

    https://www.dropbox.com/s/m3a9c8igkzh9j5p/Captura%20de%20tela%202014-02-12%2013.14.19.png

    in firefox, this is the markup shown in the elements console (the image url is correct, but look that there is a “qbfrdtrjcpyjcqxlodhz” class in the img element).

    https://www.dropbox.com/s/7v9jo4ptyvtu4bn/Captura%20de%20tela%202014-02-12%2013.22.27.png

    In this case, I have only two relationship itens.
    If I access the img url link, the image shows up.

    Additional infos: running in a local server (MAMP)

  • I tried a couple of things but neither worked. First I just removed the setup_postdata($post); from the code but in doing that the page looked the same.

    Next I tried the following code:

    <header>
    
    <!--logo/nav/social-->
    <div class="container">
    
    <!--logo-->
    	<a class="logo" href="<?php bloginfo('url'); ?>">
    		<img class="logo" src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>" />
    	</a>
    	
            
     <?php include(TEMPLATEPATH . '/nav.php'); ?>
     
     <div class="social">
         <a class="facebook" href="#" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/facebook.png" alt="<?php bloginfo('name'); ?>" /></a>
    	 <a class="twitter" href="#" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/twitter.png" alt="<?php bloginfo('name'); ?>" /></a>
    	 <a class="youtube" href="#" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/youtube.png" alt="<?php bloginfo('name'); ?>" /></a>
         <a class="linkedin" href="#" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/linkedin.png" alt="<?php bloginfo('name'); ?>" /></a>
     </div><!--end.social-->
     
    <div class="clear"></div>
    
     <!--mobile header-->
     <div class="phone-nav visible-phone visible-tablet">
            <div class="mobile-phone visible-phone visible-tablet">
            
            <?php $posts = get_posts(array(
                	'post_type' => 'siteinfo',
                    'posts_per_page' => -1,
                    'orderby'=> 'ID',
                    'order' => 'ASC'
                  ));
    			  		
    	if ( $posts->have_posts() ) : while ( $posts->have_posts() ) : $posts->the_post();  
                         
    	$phone = get_field('phone_number'); ?>
    			
            <a class="phone-btn"  href="tel:1-<?php echo $phone; ?>"><img class="phone-icon" src="<?php bloginfo('template_directory'); ?>/images/white-phone.png" alt="menu" /><?php echo $phone; ?></a>
            </div>
            <div class="mobile-menu visible-phone visible-tablet"><a id="responsive-menu-button" href="#sidr-main"><img class="menu-icon" src="<?php bloginfo('template_directory'); ?>/images/menu-icon.png" alt="menu" />Main Menu</a></div>
     </div>
    
    </div><!--end.container-->
    <div class="mobile-back"></div>
    
    </header>
    
    <div class="phone-google">
    <div class="container">
    
    				<div class="phone">
    				    <p><img class="phone-img" src="<?php bloginfo('template_directory'); ?>/images/phone.png" alt="<?php bloginfo('name'); ?>" />
    	                
    	                <span><?php echo $phone; ?></span></p>
    	            </div><!--end.phone-->
                
       <?php endwhile; // end of the loop. 
    endif; ?>
                    
                    <div class="g-plusone" data-size="large"></div>
                                        
    <!-- Place this tag after the last +1 button tag. -->
    <script type="text/javascript">
    (function() {
       var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
       po.src = 'https://apis.google.com/js/plusone.js';
       var s = document.getElementsByTagName('script')[0];   s.parentNode.insertBefore(po, s);
    })();
    </script>
                                        
               
                    
    </div><!--end.container-->
    </div><!--end.phone-google-->

    But that made everything below the navigation disappear.

    Can you see anything else I may be doing wrong?

    Thanks!

  • Hi,

    I’m getting this on all edit pages and posts (even if no custom fields associated on those types)

    migrateWarnings
    ["jQuery.attrFn is deprecated", "jQuery.browser is deprecated"]
    	"jQuery.attrFn is deprecated"
    	"jQuery.browser is deprecated"

    On the post edit screens, I get acf-loading icons constantly spinning where acf fields would normally come in. It hangs forever and also disables all standard WP functionality eg, add featured image, switch between Visual or Text etc. Screen tab at top… nothing works/appears.

  • Hi Elliot,

    Thanks for getting back to me.

    The template is a custom include file. I have a custom template for my contact page and within that I’m calling the contact_details_small.php or contact_details_default.php that has the acf fields in. When the fields are placed directly in the contact template they work fine, but when I move them to the the include files I get nothing.

    I’m beginning to think maybe I’m just using the acf code wrong as the include files are definitely being read because plain html is being output. I simplified the code above so as to make it easier to understand. The full code in the include file is below:

    <?php
    require($_SERVER['DOCUMENT_ROOT'].'/pwp/wp-load.php');
    ?>
    
    <div class="phone_email_holder">
    
    <p>LARGE TEMPLATE</p>
    
    	<?php if( have_rows('phone_numbers') ): ?>
    			<?php while( have_rows('phone_numbers') ): the_row(); ?>
     			<div class="contact_field_wrapper row">
    	        	<div class="phone_email_label info_label"><?php echo get_sub_field('number_label') ?>:</div> 
    	        	<div class="phone_email_value"><?php echo get_sub_field('tel_number') ?></div>
    		    </div>
    		<?php endwhile; ?>
    	<?php endif; ?>
    	<?php if( have_rows('email_addresses') ): ?>
    			<?php while( have_rows('email_addresses') ): the_row(); ?>
     			<div class="contact_field_wrapper row">
    	        	<div class="phone_email_label info_label"><?php echo get_sub_field('email_label') ?>:</div> 
    	        	<div class="phone_email_value"><a class="" href="mailto:<?php echo get_sub_field('email_address'); ?>"><?php echo get_sub_field('email_address') ?></a></div>
    		    </div>
    		<?php endwhile; ?>
    	<?php endif; ?>
    </div>

    The “LARGE TEMPLATE” bit is being output from the above code. Just not the rest. All I’m doing is removing links from telephone numbers for the desktop version of the site and adding them back in for mobile versions.

    Thanks for looking into this.

  • Thanks for getting back to me. Looking at the console helped me find a solution.

    A couple of the field name had a question mark or forward slash in them. It seems these are illegal characters. The problem is my users will enter the field label which often contain a question mark. the field name is populated automatically but doesn’t strip out those illegal characters, leading to the JS error.

  • Hi Elliot,

    If you look at this site : http://www.sv-dhl.nl – you see that the Repeater field is working and the countdown clock isn,t.
    Repeater field above and below, the one with the pictures and the one with the logo.

    But if you look at : test.sv-dhl.nl you will see that the countdown clock is working but the repeater field isn’t. The picture one isn’t showing at all and the onne with the logo’s isn’t scrolling from right to left but stays still.

    The only different between the sites is that i remove the following line from the header.php :
    <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js”></script&gt;
    The theme i’m using is Twenty Ten.

    Basicly i’m looking for a solution to get both the repeater field and the countdown working.

    Hope this will help you a bit more.

    Gr Joy

  • Hey @elliot! Thank you very much for taking your time to answer this 😉 I have a last question: ACF creates fields in DB with same name but with a “_” as prefix, are they necessary? May I run a query to delete fields starting with a _ ?

  • Hi @juanpablob

    The above is very similar to another question here:
    http://support.advancedcustomfields.com/forums/topic/relationship-between-flexible-content-post/

    The repeater and flexible content save data in the same way, so you will both end up with very similar code.

    Please read over the linked documentation articles to see how you can filter the WP_Query args and allow for sub field values int he meta_query.

    Thanks
    E

  • Hi @joecannes

    Your code looks good, but you don’t need the double quotes around the "$myvalue" variable.

    Perhaps the value is not being loaded. You can debug the data like so:

    
    $myvalue = get_field( "cf_custom_gallery" ); 
    
    echo '<pre>';
    	print_r( $myvalue );
    echo '</pre>';
    die;
    
  • Hi @bobz

    There is no limit in ACF, please read:
    http://www.advancedcustomfields.com/resources/faq/losing-data-save/

    Thanks
    E

  • Hi @Will

    The issue is that you are using the_row twice within the loop!

    Only use it once per loop like so:

    
    <?php
    if( have_rows('resources') ):
     
    	while ( have_rows('resources') ) : $row = the_row();
    
    		$type = $row['resource_type'];
    		echo "<h3>Type: " .  $type . " </h3>";
    	
    	endwhile;
    endif;				
    ?>
    

    Thanks
    E

  • Hi @gauden

    It is possible to query all the posts that have selected ‘Quest A’ within the flexible content field.

    You will need to read over the following tutorials:
    http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/#example-5
    http://www.advancedcustomfields.com/resources/tutorials/querying-relationship-fields/

    Thanks
    E

  • Hi @chrisg

    $post_id = $pid; should be $post_id = "user_{$pid}";

    Please also debug your code before using the update_field function to make sure all the data is correct.

    it is most likely that $pid is not what you think it is.

    Thanks
    E

  • Hi @ramesh

    There is no limit from either WP or ACF.
    Does this answer your question?

    Thanks
    E

  • Hi @sja

    jQuery is a JS library that allows you to place event listeners on elements. One of these events is called ‘blur’. This is for when you blur out of an input field.

    There is no need to add an onblur attribute to the element, this is ‘old school’. Instead, use jQuery to attach an event listener to the element.

    Please refer to Google for any more help with the blur event.

    Thanks
    E

  • Managed to solve this like this:

    <?php 
    
    $distributor = get_field('distributors'); ?>
    
    <select>
    	<option value=""></option>
    	<?php foreach ($distributor as $key => $value) {
    		echo "<option name='' id=''>" . $distributor[$key] . "</option>";
    	} ?>
    </select>
  • Hi @dadra

    This can be achieved no different to that of a regular field:
    http://www.advancedcustomfields.com/resources/field-types/image/

    You can echo a size like so:
    echo '<img src="' . $image['sizes']['thumbnail'] . '" alt="' . $image['alt'] . '" />';

  • Hi @almer1984

    It is possible to query more than one custom field by first allowing for multiple $_GET variables in your pre_get_posts filter. To do this, simply copy and paste your onderwerp code and change the field_name.

    You will need to change quite a bit of your JS to allow for multiple values to be added to the URL. I would advise that you write a function that returns the URL based on all the selected checkbox values.

    You can then attach another ‘click’ event to the second checkbox inputs and use this function to redirect the URL.

    I would just like to point out that this PHP and JS logic is quite advanced, and I won’t be able to help much on this free ACF support forum. If the task seems too complicated, perhaps try breaking it up into steps and research these independently.

    Hope that helps.

    Thanks
    E

  • I was looking for the same thing and tried the example above, was the good way but no so simple for me, finally it done this :
    1 : create the checkbox field with the different size
    (thumbnail : thumbnail
    medium : medium
    large : large
    full : full
    custom-size : custom-size)
    2 : the code to display

    <?php 
    $attachment_id = get_field('image');
    $field = get_field_object('size');
    $value = get_field('size');
    $label = $field['choices'][ $value ];
     
    $image = wp_get_attachment_image_src( $attachment_id, $label );
    // url = $image[0];
    // width = $image[1];
    // height = $image[2];
    ?>
    
    <a href="<?php echo $image[0]; ?>" class="fancybox"><img src="<?php echo $image[0]; ?>" /></a>

    It works good and the check box very easy to use !
    Now have to find a solution to the Gallery field…

    We really need this feature, without all the pictures are full size !! it looks a detail but when you have a lot of pictures to manage you understand how important it is. Many Thanks ! ACF is great !

  • Hi @thesrpr

    I just noticed that your code is completely overriding the $args.
    This is why the WP_Query is breaking. Please modify the $args, not override them.

    You can do this like so:

    
    $args['posts_per_page'] = 200;
     
    return $args;
    
  • Hi @Sintel

    Sorry, I do not understand your question. Can you please clearly describe your question in an easy to understand manor.

    Thanks
    E

  • Hi @sixfootjames

    To respond to your original question, to query a value which is saved as an array, you will need to perform a LIKE compare. You can read about this here:
    http://www.advancedcustomfields.com/resources/field-types/checkbox/

    For a good understanding of how to create a front end search engine, try this:
    http://www.advancedcustomfields.com/resources/tutorials/creating-wp-archive-custom-field-filter/

    Thanks
    E

  • Hi all, here is an update.

    I am using a text input field to add a shortcode. My shortcode looks like this:

    [fancygallery id="1" album="6"]

    in my php page, I am doing this:

    <?php
    	$myvalue = get_field( "cf_custom_gallery" ); 
    
    	
        echo do_shortcode("$myvalue");
    ?>

    but it is not outputting. If I manually do this:

    <?php
    	
        echo do_shortcode('[fancygallery id="1" album="6"]');
    ?>

    it works.

    ANy suggestions ?

    Thanks,

    JC

  • FYI – The Tri.be support forum found a resolution for issue with a snippet to de-register the acf-datepicker that, according to them, is conflicting with the use of standard jquery-ui-datepicker. From https://tri.be/support/forums/topic/plugin-conlict-js-errors-from-tec-front-end-acf-form-on-an-event-template/ :

    What is happening is that ACF is using it’s own custom datepicker, enqueued with “acf-datepicker”. The thing is, it conflicts with WP’s ’jquery-ui-datepicker’, which is basically the same thing only it is provided by WordPress. Our plugin uses ’jquery-ui-datepicker’ to avoid conflicts just like this. Other plugins need to be using the scripts that WordPress provides, as this limits conflicts and optimizes the site loading times. Unfortunately ACF is not doing this.

Viewing 25 results - 18,776 through 18,800 (of 21,363 total)