Support

Account

Home Forums Search Search Results for 'field not displaying'

Search Results for 'field not displaying'

reply

  • Hi I have tried this a few ways, but I don’t think I’m doing it correct. :S I’m not a PHP guru. Can you help me know where exactly my values need to go in that code? Assume my taxonomy is “Research”. Also, I really want to avoid specifying an actual term ID. I would like the fields to be pulled automatically for every term displaying on my archive page.

  • I think Elliot is still working on this. BTW, there is another support thread here on the same issue: http://support.advancedcustomfields.com/forums/topic/relationship-field-post-types-not-displaying-correctly/

  • I am using acf5 beta. The form is displaying on the front end fine, submits and then calls my php script with the acf save function in it.

    The php script called by the form action has the correct array within $_POST so the values are available, just not sure why acf is not saving them.

    1. The form

    <?php get_template_part('templates/wrapper-header'); ?>
    
    	<?php
    	/*
    	When the form is submitted we call this file to deal with it's submission
    	Below we have a function and then a condition to call the function. The conditional is $_POST['submit'] so the function is only called if the form is submitted
    	*/
    	
    	// Get the current user 1
    	$userID = get_current_user_id();
    	?>
    
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                            
            <h1 class="editor editor-title"><?php the_title(); ?></h1>
            
            <div class="editor editor-content"><?php the_content(); ?></div><!-- end editor -->
            
            <form method="post" action="<?php echo get_template_directory_uri(); ?>/frontend-form-acf-siteaddresses.php">
            
            	<?php
                acf_form(array(
                    'field_groups' => array('1632'), // the ID of the field group (group not field name or key, the entire field group)
    				'post_id' => 'user_'.$userID, // To populate the front end form fields with saved data
                    'form' => false // Don't load the full acf form, just load the fields into my html form
                ));
    			?>
                
                <input type="hidden" name="function" value="ttm_frontend_form_acf_siteaddresses">
    
            	<input type="submit" value="Submit">
    
            </form>
        
        <?php endwhile; ?>
    
    <?php get_template_part('templates/wrapper-footer');

    2. The php script called by the form (this is called correctly and the $_POST variable contains all of the submitted fields)

    <?php require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php'); ?>
    
    <?php
    $userID = get_current_user_id();
    
    // $post_id to save against
    $postID = 'user_' . $userID;
    
    //echo '<pre>';
    //var_dump($fields);
    //echo '</pre>';
    
    // update the post
    do_action('acf/save_post', $postID);
    ?>

    Any ideas?

    Thanks

  • I think you’re going to need to check the value of your field that sets the condition for the field you want to display, and then write the PHP to either show or not show the conditional field. This is what I do when building templates.

    
    if (get_field('condition_field')) {
      the_field('conditional_field');
    }
    

    Not sure how you can translate that with the array returned by get_fields(). The test is going to need to be build into the loop you’re using to show your values, probably defeating the purpose using of get_field() since I’m assuming it is because you have a lot of fields to display.

    I don’t use this function because 99% of my field names begin with “_” (underscore) which makes the function pretty useless for me.

    You’re suggestion of deleting the value if the condition is false I think would be difficult. I think the only way to do this would be to find and delete all value before inserting the new values. My suggestion here would be to use the hook “acf/save_post” and in your hooked function use the WP function “delete_post_meta()” to delete all the meta values you want to have cleared. You may also need to scrub through the $_POST array to remove any values that should not be set. Really, it would be easier to use my first suggestion and do a test when displaying them then to do all of the work involved with clearing values before the save.

    I don’t think this is something that ACF should do by default because everyone may not want this to happen. For example, having the values saved and not cleared makes it easy for users to switch back and forth between 2 options without needing to reenter any data. My clients would find that quite annoying.

    I don’t think the JavaScript used in the admin/forms for showing and hiding conditional fields will work without the form or in templates, you may need to write your own JS to do this.

  • Hi emcniece thanks for the code however its still does not provide me with the results I am looking for. Im trying to get the field of the taxonomy term page. Like if I wanted to put an image on each category page. Here is the link to the existing site and as of right now its displaying the code you provided. http://gotradio.drift2.com/radioroom/alternative-attic/

    To elaborate more on the over all goal I want to be able to have a custom slider, and custom css applied to on all pages, taxonomy term pages, and even post.

  • This is the syntax i used for displaying an image:
    <img src="<?php the_field('site_plan'); ?>" alt="" />

    site_plan is the field slug.

    It’s not totally clear that it’s displaying the text fields. Can you confirm?

  • hi, @elliot

    I’m was writing new forum thread, but when start selecting “tags”, found this post 🙂


    @dashaluna
    , means “displaying it as bullet list” – taxonomy field with radio button type..

    so, i have same problem..

    I have three ACF field groups.

    First – field group “general”:
    -some fields,
    -taxonomy field, field type – radio button, “Load & Save Terms to Post” checked.

    And two more – field groups “child1” and “child2”:
    -some fields,
    -and group options, “Show this field group if” : post taxonomy -> equal -> specified taxonomy element.

    According to my configuration, this must work thus:

    When editing/creating post, and selecting taxonomy field value by radio button, ACF, according on my group options for “child1” and “child2” field groups, it must show me the field group on, which approaches under the condition..

    But this does not work since must..
    It seems to me that the problem in Load & Save Terms to Post with radio button taxonomy field

    If i go to “general” field group options & change taxonomy field type from radio button to checkbox – it’s all will be work fine.

    so that it is possible with this to do?)

  • I greatly appreciate free help. However, I don’t appreciate snarky replies to a simple question about a PAID add on. And yes, I do indeed expect customer support for something I paid for.

    It wasn’t clear to me if I should be using code from http://www.advancedcustomfields.com/resources/getting-started/displaying-custom-field-values-in-your-theme/, http://www.advancedcustomfields.com/resources/getting-started/code-examples/ or http://www.advancedcustomfields.com/resources/field-types/gallery/, hence me asking what I was missing.

    To you, as the plugin developer, it is obvious. To plugin users, especially those new to the plugin, it is not always obvious. I wasn’t looking to be spoon fed an answer, otherwise I wouldn’t be modifying the code myself to work with the Genesis framework. I was simply asking for clarification about which code I should be using.

    It’s ironic that you mention patience and appreciation. Being patient with paying customers and appreciative that they’ve put some extra money in your pocket are the basics of good customer service.

    Ta, Elliot. Hope the plugin continues to go well for you.

  • Hi @albertoletscode

    I don’t understand your issue, but it is clear that you do not yet understand how to use ACF.

    Please note you do NOT need to use the ‘export to PHP’ feature.

    Please read the getting started chapter here:
    http://www.advancedcustomfields.com/resources/getting-started/what-is-acf/
    http://www.advancedcustomfields.com/resources/getting-started/creating-a-field-group/
    http://www.advancedcustomfields.com/resources/getting-started/displaying-custom-field-values-in-your-theme/

    Thanks
    E

  • Thank you @elliot for the quick reply.

    Before the update to acf or wp the prepend would display on the front end. E.g. If I had “Title: ” in the prepend and “WordPress 101” in the input field. The front end would display “Title: WordPress 101”.

    The displaying of the prepend of the input field is no longer happening. The “Title: ” is not displaying on the front end, just the value put in the field input.

    Thanks Elliot.

  • Hi @caseyaust

    The repeater field is not displaying at all. Can you confirm you have installed and activated the repeater field add-on?

    Thanks
    E

  • Hi @moralejf

    The ‘home page’ or ‘blog page’ does not have a global $post object becuase the query is to load the posts.

    This means that a get_field call won’t work because ACF doesn’t know which page to load from.

    A solution for this is to check if the page is_home:
    http://support.advancedcustomfields.com/forums/topic/acf-fields-not-displaying-on-posts-page/

  • Hi @shatilarefin,

    Can you please wrap your code in backticks so it is formatted and easier to read.

    I am not 100% sure what you are asking here but it sound like you want to be able to let your customers input their own data. This is not a simple change and you will need to be confident with PHP to achieve this functionality.

    Here is a good place to start => http://www.advancedcustomfields.com/resources/getting-started/displaying-custom-field-values-in-your-theme/

    Good luck. 🙂

  • Hi @diausru

    The language barrier is making it hard for me to understand what you mean by:
    I want that the field is displayed if it is filled, in case if the field is blank, I want does not appear in the form in front-end, thanks ,

    If the field is not displaying correctly, perhaps the issue is a misspelled field_name?
    Perhaps ACF does not know which post to get the value from?
    What page template are you adding this code to?
    If you use a wp function such as the_title() next to it, does the title display of the correct post?

    Thanks
    E

  • I have WordPress 3.8 / ACF 4.3.4 and PolyLang 1.3.1.

    I can see the fix above included in core/fields/relationship.php but still cannot get Polylang to work with ACF.

    When I look in the database, it has the fields, but when I view the page, any advanced custom fields are not displaying in correct language, so something still isn’t being mapped properly.

    what additional info would you all need to help?

    thanks much
    William

  • Hi @savvaskef

    Are you trying to ‘edit’ an existing post?
    Or are you trying to create a form to create a new post?

    Usually, when you need to define the field_groups arg, you are creating a new post. If this is the case, please remove the ‘post_id’ parameter.

    Also, you must better describe what you are seeing. When you say ‘blank’, do you mean the entire screen is white? Or just that the form is not displaying?

    If the screen is completely white, please turn on DEBUG_MODE in your wp-config.php file to show PHP errors. It is possible that you have a syntax error.

    Thanks
    E

  • Elliot,

    Thanks for the response. I tried that method of adding the post ID to the field call.

    In the code copied below, you can see at the top of the page in the h1 tag that I am calling the field “home_slide_text” and a few other custom fields from post 5. Using that call the custom field could not be found. In addition, you can also see in the screenshot the two fields ‘m looking to display, how they are setup, and the post ID at the bottom of the Home Page at the bottom.

    Could the query on the custom post type be the problem the custom fields are displaying?

    <?php
    /*
    Template Name: Home Page
    */
    ?>
    
    <?php get_header(); ?>
    
    <div class="main slide_wrapper">
    
    <?php if (have_posts()) : ?>
         <?php while (have_posts()) : the_post(); ?>
         	<section class="section home resize">
    			<div class="slide_bg home"></div>
    				
    			<div class="slide_content">
    	         	<h1><?php get_field('home_slide_text', 5); ?></h1>
    	         	<h2><?php get_field('home_slide_subheader', 5); ?></h2>
    	         	<hr>
    			</div>
         	</section><!-- end slide --> 
         	
    	 	<?php 
    		 	$args = array( 
    		 		'post_type' => 'gallery', 
    		 		'posts_per_page' => -1,
    			);
    		 	
    		 	$loop = new WP_Query( $args );
    			$slide = 1;
    	 	?>
    	 	<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    	 		<section class="section gallery resize">
    				<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'original' ); ?>
    				<div class="slide_bg" style="background-image: url('<?php echo $image[0]; ?>')"></div>
    				
    				<div class="slide_content gallery_link">
    					<a href="<?php the_permalink(); ?>">
    						<h1><?php echo the_title(); ?></h1>
    						<hr>
    					</a>
    				</div>
    	 		</section>
    		<?php endwhile; // end of the loop. ?>
         	
         	<section class="section about">
         		<div class="about_bg"><img src="<?php echo get_template_directory_uri(); ?>/images/about_bg.jpg"></div>
    			<div class="container">
    				<div class="slide_header">
    					<h2>About Me</h2>
    					<hr>
    				</div>
    				
    				<div class="about_content">
    	         		<?php show_post('About'); ?>
    				</div>
    			</div>
         	</section><!-- end slide -->
    		
    		<section class="section contact">
         		<div class="contact_bg"><img src="<?php echo get_template_directory_uri(); ?>/images/contact_bg.jpg"></div>
    			<div class="container">
    				<div class="slide_header">
    					<h2>Contact Me</h2>
    					<hr>
    					<div class="contact_info">
    						<p>408.727.3113</p>
    						<p>1140 Walsh Avenue, Santa Clara, CA 95050</p>
    						<p><a href="mailto:[email protected]">[email protected]</a></p>
    					</div>
    				</div>
    				
    				<div class="contact_content clearfix">
    					<div id="map"></div>
    					
    					<div class="form_wrapper">
    	         			<?php show_post('Contact'); ?>
    					</div>
    				</div>
    				
    			</div>
    		</section><!-- end slide 9 -->
        
         <?php endwhile; ?>
    <?php endif; ?>
    
    </div><!-- end slide_wrapper -->
    
    <?php get_footer(); ?>
  • okay, i set DEBUG_MODE to ‘TRUE’….and I do not get any Error or Debugging information on the page.

    Just so you know the Data results that I created in ACF are displaying & linking properly…but my page template loses its Sidebar, Footer, and the WordPress Admin Bar at the Top disappears (only on this specific page) — when I select Post_Object as the Field Type…it seems to only happen when I select Post_Object.

    Below is the code I used — I dont think this code is the issue, because even when I remove the entire code, it still doesnt show the sidebar, widget, and WP Admin bar….it only seems to happen when I select Post_Object in the sub field ACF settings: (in my case, “game_name” is set as Post_Object)

    <?php if(get_field('list_of_games')): ?>
      <?php while(has_sub_field('list_of_games')):?>
    
        <?php 
          $post_object = get_sub_field('game_name');
             
          if( $post_object ): 
          // override $post
          $post = $post_object;
          setup_postdata( $post ); 
        ?>
         <div>
           <ul>
           <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a</li>
           </ul>
              <span><?php the_sub_field('list_of_games'); ?></span>
          </div>
            <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
        <?php endif; ?>
      <?php endwhile; ?>         
    <?php endif; ?>

    Any ideas?… :-/

    I appreciate your help. Thanks.

  • tl;dr Forum isn’t having any part of displaying the encoded text as anything but output. Save the email address as a variable first and then pass it to antispambot to make all of you obfuscation dreams come true. If you view source on this forum post and search for “foo” you can see it in action.

    Interesting. I’m not sure why but I see a way around it. Perhaps @elliot can explain the discrepancy.

    Note: the_field("test_email") was saved as "[email protected]"
    THIS CODE:
    <h2> The Email: <?php echo antispambot( "[email protected]" ) ?> </h2>
    <h2> The Email: <?php echo antispambot( the_field("test_email") ) ?> </h2>
    OUTPUTS:
    <h2> The Email: test@test.com </h2>
    <h2> The Email: [email protected] </h2>

    THIS CODE: (Save as variable first)
    <h2> The Email: <?php echo antispambot( "[email protected]" ) ?> </h2>
    <?php $email = get_field("test_email"); ?>
    <h2> The Email: <?php echo antispambot( $email ) ?> </h2>

    OUTPUTS: What you (we!) were expecting:
    <h2> The Email: test@test.com </h2>
    EDIT: Can’t get it to display properly in the forum but this email address is obfuscated.
    <h2> The Email: foo@bar.com </h2>

    edited for clarity.

  • Hi, @Elliot! Thanks very much for the fast reply, I really appreciate it!
    *Both fields are displaying on every back end Dashboard page and post page, just not [main blog page] on the front end, live site.

    Screenshots and code for everything, I hope this helps:

    1) Markup of the fields, for all Default Template pages (page.php), single post pages (single.php), and main blog page (index.php):
    1 Markup

    1B) Each of the fields have been coded like this:

    <div class="column-all-left">
       <div class="sidebar-categories"><?php get_sidebar(); ?></div>
       <div class="sidebar-content-left"><?php the_field('sidebar-content-left'); ?></div>
    </div>
    <div class="sidebar-content-right"><?php the_field('sidebar-content-right'); ?></div>
    <div class="content-default-center">

    CSS markup includes:

    div.column-all-left {background: burlywood; float: left; margin-right: 2%; width: 14%; padding: 0 2%; font-size: 80%; word-break: break-word; display: block;}
    .sidebar-content-right {background: burlywood; margin-left: 2%; float: right; width: 14%; padding: 0 2%; font-size: 80%;}
    .sidebar-content-left {background: yellowgreen;}
    div.content-default-center {background: burlywood; margin-left: auto; margin-right: auto; min-width: 56%; padding: 0 2%; overflow: hidden;}

    2) Setup of the custom fields, themselves (*I’ve tested the pages all using the same field names, plus using different field names just for the blog – still, same results):
    2 Fields Setup

    3) Fields displaying properly in back end Dashboard, for all pages and post pages, including blog page (blog page, displayed here):
    3 Back End Fields Visual

    4) All the pages, visually, in action! **Commentary added to the image…I hope I didn’t overcomplicate …I’m sure I have OCD 😀
    4 All Live Pages

    I’m really hoping, this is just a matter of me messing up in the CSS markup or something :s

    Thank you so much!!

  • Hi @elliot,

    When layouts get lost after saving they are not available for selection on a post edit page any more. But as long as I don’t save the post the lost layouts will be displayed correctly on the front end.

    When I delete a layout (which contains 20 subfields) from the flexible content field, saving of the whole field group succeeds. Also adding a new layout afterwards, saves succesfully. But adding many subfields to that new layout resulted in a failure again. Deleting additionally another layout with nearly 20 subfields allowed me to save the new layout successfully.

    Creating and displaying a new field group containing a flexible content field is no problem.

    Also execution time is no problem. Other processes which need about one minute have finished successfully.

    Is it possible, that WP limits the number of max_input_vars?

  • Hi Elliot.

    Many thanks for your reply. At the moment I’ve just been trying to get it to work inside of twentythirteen so I rule out any theme issues. So it’s in the standard twentythirteen page (page-18.php to be precise, which is just a duplicate of page.php to try this code) with your code added. The shortcode for the WP User Frontend Pro form is included in the WP admin page editor and output (correctly) by the_content() as usual. I am using the acf_form_head function. The full page code is as follows:

    <?php
    
    acf_form_head();
    
    /**
     * The template for displaying all pages
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages and that other
     * 'pages' on your WordPress site will use a different template.
     *
     * @package WordPress
     * @subpackage Twenty_Thirteen
     * @since Twenty Thirteen 1.0
     */
    
    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
    
    			<?php /* The loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    					<header class="entry-header">
    						<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
    						<div class="entry-thumbnail">
    							<?php the_post_thumbnail(); ?>
    						</div>
    						<?php endif; ?>
    
    						<h1 class="entry-title"><?php the_title(); ?></h1>
    					</header><!-- .entry-header -->
    
    					<div class="entry-content">
    						<?php the_content(); ?>
    						<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
    					</div><!-- .entry-content -->
    
    					<footer class="entry-meta">
    						<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
    					</footer><!-- .entry-meta -->
    				</article><!-- #post -->
    
    		
    			<?php endwhile; ?>
    
    <?php 	$args = array(
    				'user_id' => '2',
    				'field_groups' => array( 57 )
    			);
     
    			acf_form( $args ); 
    ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  • Sweet, thanks @Elliot that worked a charm, I now have an issue with Flexslider not co-operating but I shan’t bother you with questions about another plugin!

    Thanks again, Solved!

    Harry.

    P.S. I accidentally set this to the topic solution when I meant to set Elliots answer as it, i’m happy to change it if you tell me how, sorry!

  • I also noticed this in the repeater field Documentation –
    Overview
    This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.
    Description
    Deprecated in v3.3.4 – please replace with has_sub_field
    Added in v2.0.3

    Do I need to change

    <?php while( the_repeater_field(‘images’)): ?>

    to

    <?php while( Has_sub_field(‘images’)): ?>

    Thanks.

  • Hi @harryadf

    Your code has a few issues, but the main one is that you are not using the $thumb variable after you populate it with a value!

    Within your loop, you have code which finds the thumb:

    
    <?php $thumb = wp_get_attachment_image_src(get_sub_field('image'), 'thumbnail' ); ?>
    

    But then you ignore that value and just echo out the image like so:

    
    <img src="<?php the_sub_field('image');?>">
    

    For your thumbnail to show, you need to echo out the $thumb like this:

    
    <img src="<?php echo $thumb;?>">
    

    However, I have a feeling that your $thumb will not contain the correct value. Please make sure the return value for your field is set to ‘Image ID’ and that you are confident with the code examples on the image documentation.

    Thanks
    E

Viewing 25 results - 401 through 425 (of 508 total)