Wednesday, July 31, 2019

echo get_post_meta

https://www.wpbeginner.com/wp-tutorials/how-to-add-additional-custom-meta-fields-to-custom-taxonomies/

<?php
/**
 * The template for displaying archive pages.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package visit_nepal
 */

get_header(); ?>

 <?php
if ( have_posts() ) : ?>

<div class="package_section p-b-40">

<div class="package_detail">
<figure>
<img src="<?php echo z_taxonomy_image_url($term->term_id,'banner'); ?>" />

</figure>

<div class="banner__text text-center">
 
    <h1><?php the_archive_title();?></h1>
     
 
<!-- meta value -->
<?php
if (function_exists('get_all_wp_terms_meta'))
{
   $arrayMetaList = get_all_wp_terms_meta($category_id);
}

// array all meta fields for category/term
print_r($arrayMetaList);
?>
<?php echo print_r($arrayMetaList); ?>
    <?php
if (function_exists(‘wp_get_terms_meta’))
{
$MetaValue = wp_get_terms_meta('2', 'title-kiker' ,true);
}
//echo $MetaValue;
?>
<?php function get_post_meta( $post_id, $key = 'title-kiker', $single = false ) {
    return get_metadata( 'post', $post_id, $key, $single );
}
?> <?php echo get_post_meta( $post_ID, 'title-kiker', $single ); ?>

<p>
<?php //echo $MetaValue; ?>
</p>
       



 
 </div>
</div>

<div class="container">

<div class="main-top">
 <?php the_archive_description();?>
</div>

 <ul class="grid-3 packages_module_wrapper packages_module_wrapper--1">
   <?php while ( have_posts() ) : the_post();?>
       <li>
          <div class="package-inner">
          <a href="<?php the_permalink();?>">
          <figure class="post__figure">
             <?php
              if(has_post_thumbnail() ) {
                the_post_thumbnail('package');
              } ?>
           
              <?php if(get_field('price')){ ?>
              <div class="post__date">
              <?php the_field('price'); ?>
               </div>
               <?php } ?>
           
  </figure></a>
            <div class="package-body-inner">
              <h3><a href="<?php the_permalink();?>"><?php the_title();?></a> </h3>
<!--               <div class="package-itenary row ">
                <div class="col-md-6 col-lg-6">
                <?php if( get_field('duration') ): ?>
                  <p>Duration: <span class="itenary-font"> <?php the_field('duration'); ?>
               </span></p>
               <?php endif ?>
                 <?php if( get_field('price') ): ?>
                  <p>Start From : <span class="itenary-font"> <?php the_field('price'); ?>
               </span></p>
               <?php endif ?>
                </div>
             
              </div> -->
            </div>
          </div>
        </li>
      <?php

          endwhile;

          wp_reset_postdata();

          ?> 
    </ul>

</div>
</div>
<div class="search-not">
 <?php else :

      get_template_part( 'template-parts/content', 'searchnotfound' );

 
    ?>
    </div>
<?php endif; ?>
<?php

get_footer();?>

No comments:

Featured Post

Make money online

https://www.wpbeginner.com/beginners-guide/make-money-online/?fbclid=IwAR0_9_5aHmbB4rDisaPevdnO4uAgo0N9heHgPu1TjerjurE5ilD2NyzeB2A

Popular Posts