Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php //this lasts for a bit, through the function def
- /**
- * Template Name: Advisors Listing
- * The template for displaying all advisors grouped by their category.
- */
- function show_employee_block($employee_record)
- {
- print("Hello about to print employee record from show employee block");
- var_dump($employee_record);
- ?>
- <img src=<?php echo esc_url($employee_record->advisor_image_link) ?> alt="<?php echo esc_html($employee_record->advisor_name); ?>" title=""/>)
- <div class="attorney-information clearfix">
- <div class="attorney-name-label">
- <h3>
- <?php esc_html($employee_record->advisor_name); ?>
- </h3>
- <span class="label-text underline-label">
- <?php esc_html($employee_record->designation); ?>
- </span>
- </div>
- <p>
- <?php esc_html($employee_record->advisor_description); ?>
- </p>
- </div>
- <?php
- }
- get_header();
- echo 'Memory limit: ' . ini_get('memory_limit');
- // ini_set('memory_limit', '1024M');
- // echo 'Memory limit: ' . ini_get('memory_limit');
- // this is the closing tag for the opening php tag
- ?>
- <section class="banner-one" id="slider">
- <?php $PageBanner = ot_get_option('attorney_single_legal_consulation_background'); ?>
- <div class="about-banner" style="background: url(<?php echo $PageBanner ?> );">
- <div class="container banner-text">
- <div class="row">
- <div class="col-xs-12">
- <?php $PageHeading = ot_get_option('attorney_single_heading'); ?>
- <?php if (!empty($PageHeading)): ?>
- <h1 style="font-size:400%;"><?php echo esc_html($PageHeading); ?></h1>
- <?php endif; ?>
- </div>
- </div>
- </div>
- </div>
- </section>
- <!--content Section Start Here -->
- <div id="content">
- <!--advisors-listing-container Section Start Here -->
- <!-- <section class="advisors-listing-container">-->
- <section class="attorney-listing">
- <div class="container">
- <div class="row">
- <div class="col-xs-12 col-sm-6 col-md-4 attorney-listing-box zoom">
- <?php
- // Initialize an empty array to hold employees by category
- $employees = [];
- // Query custom post type 'advisor'
- $args = [
- 'post_type' => 'attorney',
- 'posts_per_page' => -1, // Get all advisor posts
- ];
- $advisor_query = new WP_Query($args);
- // $total = $advisor_query->found_posts;
- // echo("Total posts: " . $total);
- echo("This is the memory usage before the input loop");
- echo("Memory used: " . memory_get_usage() . " bytes");
- if ($advisor_query->have_posts()):
- while ($advisor_query->have_posts()):
- // $advisor_query->the_post();
- // get the designation to be able to lower case it
- $designation = get_post_meta(get_the_id(), 'attorney_designation', true);
- $designation_lower = strtolower(get_post_meta(get_the_id(), 'attorney_designation', true));
- // Get the designation (role/title) of the advisor
- $advisor_record = [
- "advisor_name" => get_the_title(),
- "designation" => $designation,
- "designation_lower" => $designation_lower,
- "advisor_description" => get_the_content(),
- "advisor_image_link" => get_post_meta(get_the_id(), 'attorney_detailed_page_image', true),
- ];
- // Categorize employees based on designation
- // if (strpos($designation_lower, 'shareholder') !== false) {
- if (str_contains($designation_lower, 'shareholder')) {
- $employees['shareholders'][] = $advisor_record;
- } elseif (str_contains($designation_lower, 'cpa') || str_contains($designation_lower, 'accountant') || str_contains($designation_lower, 'tax advisor')) {
- $employees['cpas'][] = $advisor_record;
- } else {
- $employees['admin'][] = $advisor_record;
- }
- echo("This is the memory usage during the input loop");
- echo("Memory used: " . memory_get_usage() . " bytes");
- wp_reset_postdata();
- echo("This is the memory usage after resetting post data in the loop");
- echo("Memory used: " . memory_get_usage() . " bytes");
- wp_reset_postdata();
- endwhile;
- endif;
- echo("This is the memory usage before wp_reset_postdata");
- echo("Memory used: " . memory_get_usage() . " bytes");
- // wp_reset_postdata();
- echo("This is the memory usage after wp_reset_postdata");
- echo("Memory used: " . memory_get_usage() . " bytes");
- ?>
- <!-- Output Employee Groups -->
- <?php if (!empty($employees)) : ?>
- <div class="employee-groups">
- <!-- Shareholders Group -->
- <?php if (!empty($employees['shareholders'])) : ?>
- <h1 style="font-family: 'Lato';font-size:200%;">Shareholders</h1>
- <?php foreach ($employees['shareholders'] as $shareholder) :
- show_employee_block($shareholder);
- endforeach;
- endif; ?>
- <!-- CPAs/Accountants Group -->
- <?php if (!empty($employees['cpas'])) : ?>
- <h1 style="font-family: 'Lato';font-size:200%;">Accountants / CPAs</h1>
- <?php foreach ($employees['cpas'] as $cpa) :
- show_employee_block($cpa);
- endforeach;
- endif; ?>
- <!-- Administrative Staff Group -->
- <?php if (!empty($employees['admin'])) : ?>
- <h1 style="font-family: 'Lato';font-size:200%;">Administrative Staff</h1>
- <?php foreach ($employees['admin'] as $admin) :
- show_employee_block($admin);
- endforeach;
- endif; ?>
- </div>
- <?php else: ?>
- <p>No advisors found on this run.</p>
- <?php endif; ?>
- </div>
- </div>
- </div>
- </section>
- <!--advisors-listing-container Section End Here -->
- </div>
- <!--content Section End Here -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement