Support

Account

Forum Replies Created

  • Any developments on this? I’ve been using this code to do this on the other 2 media input templates:
    http://stackoverflow.com/questions/25894288/wordpress-remove-attachment-fields
    … but I’m using the ACF Gallery interface and would like to make it consistent. Unless I’m missing something (quite possible), there doesn’t appear to be an easy way to id and hide these with css, either.

  • Will do first thing in the morning. Cheers.

  • That prints the right ID, but using get_the_ID isn’t returning the right result.

  • Here is an example of useage in a loop. It’s not particularly long so I’m just pasting it here. Relevant code is on line 64, JSON is attached.

    <?php
    
    /*
    Template Name: Current Semester
    */
    
    get_header('courses'); 
    
    $semester = get_field('current_semester', 'option');
      ?>
    
    	<div class="content width" role="main">
    				<div class="page">
    				<?php get_sidebar('courses'); ?>
    				
    		<section class="content-container">
    			<div id="regular-content">	
    			
    				<!-- Undergraduate -->
    				  	
    				<?php
    			$ud_args = array(
    							'post_type' => 'courses',
    							'taxonomy' => 'courses-category',
    							'field' => 'term_id',
    							'terms' => $semester,
    							'meta_query' => array(
    									array(
    										'key' => 'course_number',
    										'value' => array( 100, 199 ),
    										'type' => 'numeric',
    										'compare' => 'BETWEEN'
    									)
    								),
    							'meta_key' => 'course_number',
    							'orderby' => 'meta_value_num',
       						'order' => 'ASC',
    							'posts_per_page' => '60' 
    						);
    				$ud_query = new WP_Query($ud_args);
    				if($ud_query->have_posts()) : ?>
    
    <h2 class="course-level-header">Undergraduate</h2>
    
    		<div class="courselist_content">
    				
    				<?php  while($ud_query->have_posts()) : 
    		     					$ud_query->the_post(); ?>
    		 	
    							<article id="post-<?php the_ID(); ?>" class="group course-list-wrapper">
    						<header class="index-header">
    							<h1 class="course-title">
    			<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'thales' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">	
    				<?php the_field('language_prefix'); ?> <?php the_field('course_number_prefix'); ?>  <?php the_field('course_number'); ?><?php the_field('course_number_suffix'); ?>: <?php the_title(); ?>
    			</a>
    		</h1>
    	
    						</header><!-- .entry-header -->
    
    						<div class="course-content">
    								<p class="section-spacing">
    
    								<?php the_field('timeframe'); ?> <span class="course-details"><?php the_field ('location'); ?></span>
    								<span class="course-details"><b>Instructor: <?php $post_object = get_field('instructor', $post->ID); ?> <a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo $post_object->post_title; ?></a></p>
    
    </b></span>
    								</p>
    <?php the_content(__(' &raquo;  read more  &raquo;'));?>
    <p class="section-spacing">Course Catalog Number: <?php the_field ('ccn'); ?></p>
    						</div><!-- .course-content -->
    
    			</article><!-- #post-<?php the_ID(); ?> -->
    
            				</div>
    	
    				<?php endwhile; ?>
    			<?php endif; ?>		
    		<?php wp_reset_query(); ?> 
    
    			</div>
    		</section><!-- #content-container -->
    
    		</div>
    		</div>
    
    <?php get_footer(); ?>
  • Yes, I’m using this inside of a loop. Adding a proper post id returns the right result.

    Now how would I get the proper post id for each item in the loop and return the title and link? I assume it would look something like:

    <?php $post_object = get_field('instructor', $post->ID); ?>
    
    <p><a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo $post_object->post_title; ?></a></p>

    … but that doesn’t work.

  • So.

    Any updates on this? Or is this not an important enough issue to update?

  • Thanks – I’ll take it for a test toast and see what happens…

  • I have a whole site that basically relies on this plugin, so I’d REALLY like to see it get fixed and/or added to the core. As it stands I have some very angry clients and need to find a solution for them.

  • I just set the wp_query loops to use ‘term_id’ and set the Options Page variables to return that, but I’d still like to know how to use the Term Object and return values like slug and name.

  • Sorry – that was extremely unclear.

    Here is what I need: to be able to select a taxonomy on the options page and pass the name and slug for the taxonomy to other pages.

    When I use get_field as discussed on the taxonomy page:
    $term = get_field('summer_semester', 'option');

    It’s not returning $term->name or $term->slug

    So I’m assuming I need to do something different when the $term is coming from the options page.

Viewing 10 posts - 1 through 10 (of 10 total)