0% found this document useful (0 votes)
15 views8 pages

Point

The document contains PHP code and CSS styling for an accordion menu and report template. It retrieves section terms from a taxonomy and displays AER reports under each section with titles, links, and attachments. JavaScript is used to toggle the display of unit-wise and theme-wise sections.

Uploaded by

Zaheer Siddiqui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views8 pages

Point

The document contains PHP code and CSS styling for an accordion menu and report template. It retrieves section terms from a taxonomy and displays AER reports under each section with titles, links, and attachments. JavaScript is used to toggle the display of unit-wise and theme-wise sections.

Uploaded by

Zaheer Siddiqui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 8

<?

php
/*
Template Name: Aer Report
*/
get_header();
?>

<style>
/* Add this on css file*/
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}

.active, .accordion:hover {
background-color: #ccc;
}

.panel {
padding: 0 18px;
background-color: white;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
p span{display: inline;}
.panel-heading{

border: 1px solid #dee2e6;


width: 100%;
margin-top: 15px;
background-color: #3264f5;
}
.panel-title{
margin-left: 10px;
}
.navbar .nav li {
display:inline;
list-style-type :none;

.navbar .navbar-nav li{


float:left;

}
.navbar .navbar-nav .unit-wise a{
background: #a90078;
color: #fff;
margin: 18px 21px;
cursor: pointer;
-webkit-transition-duration: 0.4s;
transition-duration: 0.4s;
padding: 13px;
text-transform: uppercase;
text-decoration: none;
}
.navbar .navbar-nav .theme-wise a{
background: #a90078;
color: #fff;
margin: 18px 21px;
cursor: pointer;
-webkit-transition-duration: 0.4s;
transition-duration: 0.4s;
padding: 13px;
text-transform: uppercase;
text-decoration: none;
}
.navbar .navbar-nav .theme-wise a:hover{background:#f021b6;}
.navbar .navbar-nav .center-unit-wise a:hover{background:#f021b6;}
.bg-light{background: none!important;}
.panel-heading .panel-title a{
color: #fff;
font-size: 14px;
text-transform: uppercase;
text-decoration: none;
}
.fdficon{
display: block;
float: right;
position: relative;
float: inline-start;
margin-right: 10px;
height: 20px;
right: 1px;
}
.arrow{
float: right;
margin: 1px;
padding: 10px;
height: 35px;
box-shadow: -1px 0px red;
}
/* end css */
</style>
<script>
$(document).ready(function() {
document.getElementById( 'test3' ).style.display = 'none';
document.getElementById( 'test2' ).style.display = 'none';
$("#theme-wise").on('click', function () {
event.preventDefault();
document.getElementById( 'test2' ).style.display = 'none';
document.getElementById( 'test3' ).style.display = 'block';
reset() ;
});
$("#unit-wise").on('click', function () {
event.preventDefault();
document.getElementById( 'test2' ).style.display = 'block';
document.getElementById( 'test3' ).style.display = 'none';
reset() ;
});
});
</script>
<div class="container page_content_wrap" tabindex="0" >
<div class="row ">
<div class="col-lg-12">
<h1 class="cstm_title mt-3 mb-4" tabindex="0"><?php the_title();?
></h1>
</div>
</div>
<div class="row ">
<div class="col-lg-12" >
<div class="page_content" tabindex="0" >
<?php
$taxonomy = 'section';
$terms =
get_terms($taxonomy);
if ( $terms && !
is_wp_error( $terms ) ) :
?><nav class="navbar
navbar-expand-sm bg-light justify-content-center">
<ul class="navbar-
nav">
<?php
foreach ( $terms as $term ) {
?>
<li
class="<?php echo $term->slug;?> nav-item"><a href="<?php if($term->parent === 0){
echo get_term_link($term->slug, $taxonomy);} ?>" id="<?php echo $term->slug;?>"><?
php if($term->parent === 0){ echo $term->name;} ?></a></li>
<?php } ?>
</ul>
</nav>
<?php endif;?>
<div id="test2">
<?php
$termID = 246;
$taxonomyName =
"section";
$termchildren =
get_term_children( $termID, $taxonomyName );
foreach ($termchildren
as $child) {
$term =
get_term_by( 'id', $child, $taxonomyName );
?>
<div class="<?php echo $term-
>parent;?> panel-heading" >
<h4 class="panel-
title"><a href="#collapse<?php echo $term->term_id;?>" data-toggle="collapse"><?php
echo $term->name;?><span class="arrow">&#9660;</span></a>
</h4>
</div>
<div id="collapse<?php echo $term-
>term_id;?>" class="panel-collapse collapse in" >
<table
class="table tabledesign">
<thead>
<tr>
<th
scope="col">#</th>
<th
scope="col">AER REPORT Title</th>
<th
scope="col">AER Attachment</th>
</tr>
</thead>
<?php
$args =
array(
'post_
type' => 'aer',
'posts
_per_page' => -1,
'order
by' => 'title',
'order
' => 'ASC',
'tax_q
uery' => array(

array(

'taxonomy' => 'section',

'field' => 'slug',

'terms' => array($term->slug, $taxonomy)

)
);
$i=1;
$Query = new
WP_Query($args);

if($Query -> have_posts()):

while($Query -> have_posts()):

$Query -> the_post();

?>
<tbody>
<tr>
<th
scope="row"><?php echo $i++; ?></th>
<td><a
href="<?php the_permalink(); ?>"><?php echo the_title(); ?></a></td>
<td>
<?php

$fileID1 = get_field('pdf_english');

$fileID2 = get_field('test_24_hindi');
if ($fileID1) {

echo '<a href='.$fileID1.' download><img src="http://localhost/desagri2/wp-


content/uploads/2024/02/file-icon.png" alt="PDF FILE"
class="fdficon">Download</a>';

elseif($fileID2 ){ echo '<a href='.$fileID2.' download><img


src="http://localhost/desagri2/wp-content/uploads/2024/02/file-icon.png" alt="PDF
FILE" class="fdficon">Download</a>';}

else{echo '<a href="#">No attachment <img src="#" alt="PDF FILE"


class="fdficon"></a>';}?>
</td>
</tr>
</tbody>
<?php
endwhile;
else:

"No Administrative Offices Found. Try again later";


endif;

wp_reset_postdata();?>
</table>
</div>

<?php } ?>

</div>
<div id="test3">

<?php
$termID = 247;
$taxonomyName = "section";
$termchildren =
get_term_children($termID, $taxonomyName );
foreach ($termchildren as $child) {
$term = get_term_by( 'id',
$child, $taxonomyName );
?>
<div class="<?php echo $term-
>parent;?> panel-heading" >
<h4 class="panel-
title"><a href="#collapse<?php echo $term->term_id;?>" data-toggle="collapse"><?php
echo $term->name;?><span class="arrow">&#9660;</span></a>

</h4>
</div>
<div id="collapse<?php echo
$term->term_id;?>" class="panel-collapse collapse in" aria-expanded="true">
<table
class="table tabledesign">
<thead>
<tr>
<th
scope="col">#</th>
<th
scope="col">AER REPORT Title</th>
<th
scope="col">AER Attachment</th>
</tr>
</thead>
<?php
$args =
array(
'post_
type' => 'aer',
'posts
_per_page' => -1,
'order
by' => 'title',
'order
' => 'ASC',
'tax_q
uery' => array(

array(

'taxonomy' => 'section',

'field' => 'slug',

'terms' => array($term->slug, $taxonomy)

)
);
$i=1;
$Query = new
WP_Query($args);
if($Query ->
have_posts()):

while($Query -> have_posts()):

$Query -> the_post();

?>
<tbody>
<tr>
<th
scope="row"><?php echo $i++; ?></th>
<td><a
href="<?php the_permalink(); ?>"><?php echo the_title(); ?></a></td>
<td>
<?php

$fileID1 = get_field('pdf_english');

$fileID2 = get_field('test_24_hindi');
if ($fileID1) {

echo '<a href='.$fileID1.' download><img src="http://localhost/desagri2/wp-


content/uploads/2024/02/file-icon.png" alt="PDF FILE"
class="fdficon">Download</a>';

elseif($fileID2){ echo '<a href='.$fileID2.' download><img


src="http://localhost/desagri2/wp-content/uploads/2024/02/file-icon.png" alt="PDF
FILE" class="fdficon">Download</a>';}

else{echo '<a href="#">No attachment<img src="#" alt="PDF FILE"


class="fdficon"> </a>';}

?>

</td>
</tr>
</tbody>
<?php
endwhile;

else:

"No Administrative Offices Found. Try again later";


endif;

wp_reset_postdata();?>
</table>
</div>

<?php } ?>

</div>
<?php the_content(); ?>
</div>
</div>

</div>
<div class="row ">
<div class="col-lg-12">
<p class="m-0 text-left cp_txt mb-2 mt-4"
tabindex="0">
<?php
$lang = qtranxf_getLanguage();
if($lang=='en'){
?>
Last updated :
<?php }elseif($lang=='HI'){ ?>
अंतिम अद्यतन :
<?php } ?>
<? the_modified_time('d-m-Y, h:i A'); ?>
</p>
</div>
</div>
</div>
<?php
get_footer();

You might also like