HEX
Server: Apache
System: Linux wyse1.wyseservers.com 4.18.0-553.124.4.el8_10.x86_64 #1 SMP Fri May 15 04:14:14 EDT 2026 x86_64
User: kochikidswysewor (1061)
PHP: 8.3.33
Disabled: NONE
Upload Files
File: /home/kochikidswysewor/www/wp-content/themes/children-charity-child/template-dashboard-agent.php
<?php session_start();
/**
 * @package 	WordPress
 * @subpackage 	Children Charity
 * @version		1.0.7
 * 
 * Template Name: Agency Dashboard
 * Created by CMSMasters
 * 
 */


get_header();

list($cmsmasters_layout) = children_charity_theme_page_layout_scheme();
$user = wp_get_current_user(); 
// print_r($user);
?>
<section class="dashboard_page">
    <div class="container">
        <div class="tw-row v-gap-none">
            <?php include("agent/sidebar.php"); ?>
            <main class="tw-col-md-9 p-l-50 common_sec">
                <header class="dFlex vCenter">
                    <h1 class="sec_title">Dashboard</h1>
                    <?php include("agent/popup-btn.php"); ?>
                </header>             
                <section class="">
                    <div class="cause_list">
                         <div class="faq_wrap">
                        <?php 
                            $taxonomies = get_object_taxonomies( array( 'post_type' => 'children' ) );
                             $flag =0;
                            foreach($taxonomies as $taxo)
                               
                            {
                                
                                $cats = get_terms($taxo);
                                foreach($cats as $term)
                                {
                                   
                                    $cat_id = $term->term_id;
                                    $cat_slug = $term->slug;
                                    $cat_slug_id = 'children_categories_'.$cat_id;
                                    $cat_status = get_field('category_status', $cat_slug_id);
                                    $cat_name = $term->name;
                                    $args = array(
                                    'posts_per_page' => -1,
                                    'post_type' => 'children',
                                    'tax_query' => array(
                                        array(
                                        'taxonomy' => 'children_categories',
                                        'field' => 'term_id',
                                        'terms' => $cat_id,
                                        )),
                                    'meta_query' => array(
                                        array(
                                            'key' => 'agency_name',
                                            'value' => $user->ID
                                        ),
                                        array(
                                            'key' => 'status',
                                            'value' => 'active'
                                        )
                                    )
                                    );
                                    if($cat_status == "active")	{
                                    $category = get_category($cat_id);
                                    $count = count( get_posts( $args ) );
                                    if($count >0) {
                                         $flag =1;
                        ?>
                                       
                                            <div class="faq_item">
                                                <span class="acc_head">
                                                    <?php echo $cat_name; ?>
                                                    <svg class="ico_down">
                                                        <use xlink:href="#down"></use>
                                                    </svg>
                                                </span>
                                                
                                                <div class="acc_content">
                                                    <ul>
                                                        <?php 
                                                            $posts= query_posts( $args );
                                                            if(!empty($posts)){
                                                                foreach ($posts as $value) {
                                                                    $id=$value->ID;
                                                                    $post_status=get_field('status', $id);
                                                                    $name=get_the_title($id);
                                                                    $agency= $value->post_content;
                                                                    $agency_name=get_field('agency_name', $id);
                                                                    $link=get_permalink($id);
                                                                    if($post_status == "active") {
                                                        ?>
                                                        <li class="case_i">
                                                            <div class="case_n">
                                                                <a href="<?php echo $link; ?>"><?php echo $name; ?></a>
                                                            </div>
                                                          <!--  <div class="case_agen">
                                                                <a href="test"><?php echo $agency_name['display_name']; ?></a>
                                                            </div>-->
                                                            <div class="case_cta">
                                                                <a href="<?php echo $link; ?>" class="btn btn_sm">View</a>
                                                            </div>
                                                        </li>
                                                        <?php 
                                                                    }
                                                                }
                                                            }
                                                        ?>
                                                    </ul>
                                                </div>
                                                 
                                            </div>
                                            <?php 
                                                    }

                                                }
                                                 

                                            }
                                            if($flag ==0) { ?>
                                                   <div> <h3>No Case created yet.</h3> </div>
                                                
                                            <?php }

                                            ?>
                                       

                   <?php }
                   

                    ?>
                     </div>
                    </div>
                </section>
            </main>
        </div>
    </div>
</section>
<?php 
$post_id = $_SESSION['child_id'];
$user = wp_get_current_user(); 
$user_id = $user->ID;
if ( ! add_post_meta( $post_id, 'sponsors_', $user_id, true ) ) { 
   update_post_meta ( $post_id, 'sponsors_', $user_id );
}


?>
<?php get_footer();