Instantly share code, notes, and snippets.
Created
May 6, 2017 16:21
-
Star
(0)
0
You must be signed in to star a gist -
Fork
(0)
0
You must be signed in to fork a gist
-
Save rajendra89/16c1553adfee6ce25b442f051b2e5f50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: idc_projects | |
*/ | |
?> | |
<?php get_header(); ?> | |
<!-- Get header content --> | |
<!-- banner-image --> | |
<div class="banner-image" style="background: linear-gradient(rgba(0,0,0,0.6),rgba(0,0,0,0.6)), url('<?php echo get_field('idc_projects_img')['url']; ?>');"> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-sm-12 col-md-12 col-lg-12"> | |
<div class="bannertext"> | |
<h1><?php the_field('idc_projects_header',143); ?></h1> | |
<p><?php the_field('idc_projects_sub_header',143); ?></p> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<!-- banner-image-end --> | |
<!-- tab-section-starts --> | |
<section class="tab-section"> | |
<div class="container"> | |
<div class="row"> | |
<div class="toggle-tab"> | |
<!-- Nav tabs --> | |
<ul class="nav nav-tabs" role="tablist"> | |
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">ongoing projects</a></li> | |
<li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">completed projects</a></li> | |
</ul> <!-- Nav tabs-end --> | |
<div class="tab-content"><!-- Tab panes --> | |
<div role="tabpanel" class="tab-pane fade in active" id="home"> | |
<section class="isotop"> | |
<div class="completed-projects text-center"> | |
<h1><a href="#">ongoing projects</a></h1> | |
<p> | |
<?php the_field('idc_projects-content',143); ?> | |
</p> | |
</div> | |
<div class="container"> | |
<div class="row"> | |
<div class="iso-nav col-lg-12"> | |
<ul> | |
<li class="active" data-filter="*">all</li> | |
<?php | |
// Getting the post categories 'type'. | |
$categories = get_terms('type'); | |
foreach ( $categories as $category ) { | |
echo "<li class=\"button\" data-filter=\".".$category->slug."\">".$category->name."</li>"; | |
} | |
?> | |
</ul> | |
</div> | |
<div class="main-iso"> | |
<?php | |
wp_reset_query(); | |
// Setting the arguments for getting post | |
$args_our_projects=array( | |
'post_type'=>'our_projects', //slug value | |
'posts_per_page'=>'-1', //for getting all posts | |
'order'=>'ASC', //last input first output | |
'orderby'=>'menu_order', //according to field | |
'meta_key' => 'completed', | |
'meta_compare' => '==', | |
'meta_value' => 'no' | |
); | |
$our_projects_posts=new WP_Query($args_our_projects); | |
// Check if the post is or not. | |
if($our_projects_posts->have_posts()): | |
// Start the Loop when post is exist. | |
while($our_projects_posts->have_posts()):$our_projects_posts->the_post(); | |
// Getting the image of selected ID. | |
$image = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ); | |
// Getting the content of the selected ID. | |
$content = get_the_content(); | |
$terms = get_the_terms(get_the_ID(), 'type' ); | |
// var_dump($terms); | |
?> | |
<div class="item <?php echo $terms[0]->slug; ?> col-sm-6 col-md-3 col-lg-3" > | |
<img src="<?php echo $image; ?>" alt="<?php the_title(); ?>" > | |
<a href="<?php echo the_permalink(); ?>"> | |
<div class="overlay"> | |
<div class="lineheight"> | |
<h1><?php the_title(); ?></h1> | |
<p> | |
<?php //echo $content; ?> | |
</p> | |
</div> | |
</div> | |
</a> | |
</div> | |
<?php | |
// Resetting the Loop. | |
endwhile;endif; | |
// Resetting the query. | |
wp_reset_query(); | |
?> | |
</div> | |
</div> | |
</div> | |
</section> <!-- End of section completed projects--> | |
</div> | |
<div role="tabpanel" class="tab-pane fade out" id="profile"> | |
<section class="isotop"> | |
<div class="completed-projects text-center"> | |
<h1><a href="#">ongoing projects</a></h1> | |
<p> | |
<?php the_field('idc_projects-content',143); ?> | |
</p> | |
</div> | |
<div class="container"> | |
<div class="row"> | |
<div class="iso-nav col-lg-12"> | |
<ul> | |
<li class="active" data-filter="*">all</li> | |
<?php | |
// Getting the post categories 'type'. | |
$categories = get_terms('type'); | |
foreach ( $categories as $category ) { | |
echo "<li class=\"button\" data-filter=\".".$category->slug."\">".$category->name."</li>"; | |
} | |
?> | |
</ul> | |
</div> | |
<div class="main-iso"> | |
<?php | |
wp_reset_query(); | |
// Setting the arguments for getting post | |
$args_our_projects=array( | |
'post_type'=>'our_projects', //slug value | |
'posts_per_page'=>'-1', //for getting all posts | |
'order'=>'ASC', //last input first output | |
'orderby'=>'menu_order', //according to field | |
'meta_key' => 'completed', | |
'meta_compare' => '==', | |
'meta_value' => 'yes' | |
); | |
$our_projects_posts=new WP_Query($args_our_projects); | |
// Check if the post is or not. | |
if($our_projects_posts->have_posts()): | |
// Start the Loop when post is exist. | |
while($our_projects_posts->have_posts() ):$our_projects_posts->the_post(); | |
// Getting the image of selected ID. | |
$image = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ); | |
// Getting the content of the selected ID. | |
$content = get_the_content(); | |
$terms = get_the_terms(get_the_ID(), 'type' ); | |
// var_dump($terms); | |
?> | |
<div class="item <?php echo $terms[0]->slug; ?> col-sm-6 col-md-3 col-lg-3" > | |
<img src="<?php echo $image; ?>" alt="<?php the_title(); ?>" > | |
<a href="<?php echo the_permalink(); ?>"> | |
<div class="overlay"> | |
<div class="lineheight"> | |
<h1><?php the_title(); ?></h1> | |
<p> | |
<?php //echo $content; ?> | |
</p> | |
</div> | |
</div> | |
</a> | |
</div> | |
<?php | |
// Resetting the Loop. | |
endwhile; | |
endif; | |
// Resetting the query. | |
wp_reset_query(); | |
?> | |
</div> | |
</div> | |
</div> | |
</section> | |
</div> | |
<div role="tabpanel" class="tab-pane fade" id="messages"> | |
</div> | |
<div role="tabpanel" class="tab-pane fade" id="settings"> | |
</div> | |
</div> <!-- Tab panes-end --> | |
</div> | |
</div> | |
</div> | |
</section> | |
<!-- tab-section-ends --> | |
<?php get_footer(); ?> | |
<!-- Get footer content --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment