• This is my custom taxonomy code, called in home page.custom field not showing

    
    <?php
    	$myquery['tax_query'] = array(
    	'relation' => 'OR',
    	array(
    	'taxonomy' => 'brands',
    	'terms' => array('ALL'),
    	'field' => 'slug',
    	),
    	array(
    	'taxonomy' => 'media',
    	'terms' => array('news', 'events'),
    	'field' => 'slug',
    	),
    	);
    	query_posts($myquery);
    
    	?>
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<div class="so-post-hom">
    			<h2 class="post-title"><?php the_title();?></h2>
    
    			<h3 class="post-desc"><?php echo esc_html( get_post_meta( get_the_ID(), 'post_description', true ) ); ?></h3>
    
    		<div class="post-bar">
    			Go!
    		</div>
    	</div>
    
    <?php endwhile; else: ?>
    <?php endif; ?>
    
    

    What changes i have to do in my code ?

    This my another custom post, custom fields working perfectly

    
    this is working code
    
    $args = array( 'post_type' => 'spotlight_posts', 'posts_per_page' => 5 );
    
    $loop = new WP_Query( $args );
     while ( $loop->have_posts() ) : $loop->the_post();?>
    
    <?php echo esc_html( get_post_meta( get_the_ID(), 'employee_name', true ) ); ?>
    
    

    -Thank you-

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Hello again, your code appears correct. Are you sure post meta exists under the ‘post_description’ key? Check the postmeta table directly with phpMyAdmin or similar. Or perhaps it is hidden by CSS? Check the html source with your browser and see what is between the h3 tags.

Viewing 1 replies (of 1 total)
  • The topic ‘How gett my custom field in Home page’ is closed to new replies.