TransWikia.com

Single template showing all posts of that type

WordPress Development Asked by Aaron4osu on October 30, 2021

I have a custom post type of "Talent" built with pods and advanced custom fields. I’m using single-talent.php for to display the individual Talent. I thought this page worked fine before, but as I developed other pages I noticed that now the talent page lists all of the talent rather than the individual.

Here is a link to the live page
http://phia.devlocation.site/talent/lux/

<?php
/**
 * 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 may use a
 * different template.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package PHIA_SALON_Custom_Theme
 */

get_header();
?>
<?php
while (have_posts()) : the_post(); 
$level = get_post_meta( get_the_ID(), 'level', true );
switch ($level) {
    case 1:
        $level_icon = "icon-1.png";
        break;
    case 2:
        $level_icon = "icon-2.png";
        break;
    case 3:
        $level_icon = "icon-3.png";
        break;
    case 4:
        $level_icon = "icon-4.png";
        break;
    case 5:
        $level_icon = "icon-5.png";
        break;
    default:
        $level_icon = "icon-1.png";
}
$specialties = get_post_meta( get_the_ID(), 'specialties', true );
if($specialties != ""){ 
    $str_arr = preg_split ("/,/", $specialties);
}


$image1 =   get_post_meta( get_the_ID(), 'image_1', true );
$image2 = get_post_meta( get_the_ID(), 'image_2', true );   

$image_first = "";
$image_second = "";


if($image1 != ""){
    $image_first = get_post_meta( get_the_ID(), 'image_1', true )['guid'];
}
if($image2 != ""){
    $image_second = get_post_meta( get_the_ID(), 'image_2', true )['guid']; 
}


?>




<div class="talent-modal in" style="display: block;">
  <div class="modal-dialog" role="document">
    <div class="modal-content">

      <div class="container">
        
        <div class="modal-header">
          <p class="text-left mt10">
            <a class="gray" href="/talent" ><i class="fas fa-chevron-left" aria-hidden="true"></i> back to Talent Page</a> 
          </p>
        </div>
        </div>
        
        
                        
<div id="carousel-example-generic" class="carousel slide visible-xs visible-sm" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <?php if($image_first != ""){ ?>
        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
     <?php } ?>
      
      
    <?php if($image_second != ""){ ?>
        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
     <?php } ?>
     
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner">
      
     <div class="level text-left" style="position:absolute;z-index:111">
        <img class="" src="http://phia.devlocation.site/wp-content/themes/phia-salon-custom-theme/assets/img/<?php echo $level_icon ?>"> 
      </div><!-- close level -->
      
    <div class="item active">
      <img src="<?php echo get_the_post_thumbnail_url() ?>" alt="...">
    </div>
      
      
    <?php if($image_first != ""){ ?>
        <div class="item">
          <img src="<?php echo get_post_meta( get_the_ID(), 'image_1', true )['guid'] ?>" alt="...">
        </div>   
     <?php } ?>
      
      
     <?php if($image_second != ""){ ?>
        <div class="item">
          <img src="<?php echo get_post_meta( get_the_ID(), 'image_2', true )['guid'] ?>" alt="...">
        </div>
     <?php } ?>
      
      
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left"></span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right"></span>
  </a>
</div>
        
        <div class='container'>
        <div class="modal-body">
          <div class="row">
            <div class="col-sm-12 col-md-6 text-left">              
              <div class="level text-left hidden-sm hidden-xs">
                <img class="" src="http://phia.devlocation.site/wp-content/themes/phia-salon-custom-theme/assets/img/<?php echo $level_icon ?>"> 
              </div><!-- close level -->
              <h1 class="script mt30"><?php echo the_title(); ?></h1>
              <p class="mt40"><?php echo the_content() ?></p>
              <h3 class="green uc">Specialties</h3>
              <ul class="row specialty">
                  <?php
                    $terms = get_the_terms( $post->ID , 'specialties' );
                    if ( $terms != null){
                     foreach( $terms as $term ){
                        echo "<li class='col-xs-12 col-sm-12 col-md-6'>$term->name</li>";
                     }
                    }
                  ?> 
              </ul>
              <div class="social">
                <ul class="">
                  <li><a href="<?php echo get_post_meta( get_the_ID(), 'facebook_link', true ); ?>"><i class="fab fa-facebook-square" aria-hidden="true"></i></a></li>
                  <li><a href="<?php echo get_post_meta( get_the_ID(), 'instagram_link', true ); ?>"><i class="fab fa-instagram" aria-hidden="true"></i></a></li>                          
                </ul>
              </div><!-- close social -->
              <p class="mt20 modal-btn-book"><a class="btn btn-lg btn-phia" href="<?php echo get_post_meta( get_the_ID(), 'book_online_url', true ); ?>">Book Online</a></p>
            </div><!-- close col -->
            <div class="col-sm-12 col-md-6 images">
              <div class="row hidden-sm hidden-xs">
                <div class="col-sm-12 col-md-12">
                  <?php echo the_post_thumbnail( 'large','style=max-width:100%;height:auto;'); ?>
                </div><!-- close col -->
                
                 <?php if($image_first != ""){ ?>
                    <div class="col-sm-12 col-md-6">
                      <img class="img-responsive img-fill" src="<?php echo get_post_meta( get_the_ID(), 'image_1', true )['guid'] ?>">
                    </div><!-- close col -->
                 <?php } ?>
                  
                  <?php if($image_second != ""){ ?>
                    <div class="col-sm-12 col-md-6">
                      <img class="img-responsive img-fill" src="<?php echo get_post_meta( get_the_ID(), 'image_2', true )['guid'] ?>">
                    </div><!-- close col -->
                 <?php } ?>

                  
                  
              </div><!-- close row -->
            </div><!-- close col -->
          </div><!-- close row -->
        </div><!-- close modal body -->

        <div class="modal-footer">
            <div class='text-center mt10'>
                <!-- FOR LARGE DISPLAYS -->
                <div class="row" style='display:flex;justify-content:center;align-items:center'>
                    <div class='hidden-xs hidden-sm'>
                        <i class="fas fa-chevron-left" aria-hidden="true"></i>
                        <?php previous_post_link('%link', 'PREVIOUS TALENT'); ?>
                    </div>
                    
                    <div class='visible-xs visible-sm'>
                        <i class="fas fa-chevron-left" aria-hidden="true"></i>
                        <?php previous_post_link('%link', 'PREV'); ?>
                    </div>
                    
                    
                    <span class="spacer green" style='padding: 0px 70px;'>|</span>
                    
                    
                    <div class='hidden-xs hidden-sm'>
                        <?php next_post_link('%link', 'NEXT TALENT'); ?>
                        <i class="fas fa-chevron-right" aria-hidden="true"></i>
                    </div>
                    
        
                    <div class='visible-xs visible-sm'>
                        <?php next_post_link('%link', 'NEXT'); ?>
                        <i class="fas fa-chevron-right" aria-hidden="true"></i>
                    </div>  
                </div>
                <!-- END LARGE DISPLAYS -->
                
                <!-- FOR PHONE DISPLAYS -->
                
            </div>
        </div>
      </div><!-- close container -->

    </div><!-- close modal-content -->
  </div><!-- close modal-dialog -->
</div>


<style>
    .modal-footer a, .modal-footer i{
        color: #6b8155 !important;
    }
</style>
<?php
endwhile; // End of the loop.
?>

<?php
get_footer();

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP