Ver Fonte

Faculty archive info from api in home

Md Mozahidur Rahman há 1 ano atrás
pai
commit
62592beb42
4 ficheiros alterados com 49 adições e 7 exclusões
  1. 1 1
      archive-faculty.php
  2. 2 1
      css/theme-styles.css
  3. 43 4
      page-template/page-home.php
  4. 3 1
      single-faculty.php

+ 1 - 1
archive-faculty.php

@@ -63,7 +63,7 @@ get_header();
 						$employeeInfo = json_decode(wp_remote_retrieve_body($response_employeeInfo), true);
 						$Title = $employeeInfo[0]['Title'];
 						$FullName = $Title . ' ' . $employeeInfo[0]['FullName'];
-						$Designation = $employeeInfo[0]['Designation'] . ' ' . $employeeInfo[0]['Office'];
+						$Designation = $employeeInfo[0]['Designation'] . ', ' . $employeeInfo[0]['Office'];
 					?>
 
 

+ 2 - 1
css/theme-styles.css

@@ -1774,6 +1774,7 @@ body.archive aside#secondary{
 
 span.degree {
     font-weight: normal;
-    font-size: 13px;
+    font-size: 0.75em;
     font-style: italic;
+    font-family: inherit;
 }

+ 43 - 4
page-template/page-home.php

@@ -158,8 +158,43 @@ get_header(); ?>
                 $query = new WP_Query($args);
 
                 if ($query->have_posts()) :
-                    while ($query->have_posts()) :
-                        $query->the_post(); ?>
+                    while ($query->have_posts()) : $query->the_post();
+
+                        $login_id_e = "";
+                        $auth_token = get_field('auth_token', 'option');
+                        $client_id = get_field('client_id', 'option');
+                        $employee_info_api = get_field('employee_info_api', 'option');
+
+                        if (function_exists('get_field')) {
+                            $pid_content = get_post();
+                            if (has_blocks($pid_content)) {
+                                $blocks = parse_blocks($pid_content->post_content);
+                                foreach ($blocks as $block) {
+                                    if ($block["blockName"] == "acf/faculty-member") {
+                                        // $FullName = $block['login_id_e'];
+                                        $login_id_e = $block["attrs"]["data"]["login_id"];
+                                        // $Designation = $block["attrs"]["data"];
+                                    }
+                                }
+                            }
+                        };
+
+                        $response_employeeInfo = wp_remote_post(
+                            $employee_info_api,
+                            array(
+                                'body' => array(
+                                    'user_login_id' => $client_id,
+                                    'login_id' => $login_id_e,
+                                    'auth_token' => $auth_token
+                                )
+                            )
+                        );
+                        $employeeInfo = json_decode(wp_remote_retrieve_body($response_employeeInfo), true);
+                        $Title = $employeeInfo[0]['Title'];
+                        $FullName = $Title . ' ' . $employeeInfo[0]['FullName'];
+                        $Designation = $employeeInfo[0]['Designation'] . ', ' . $employeeInfo[0]['Office'];
+                ?>
+
                         <div class="car-item">
 
                             <div class="car-item-holder">
@@ -169,8 +204,12 @@ get_header(); ?>
                                 <a class="faculty-name" href="<?php echo get_the_permalink(); ?>">
                                     <div class="faculty-details">
 
-                                        <h2><?php echo get_the_title(); ?><span class="degree">, Ph.D.</span></h2>
-                                        <h3><span class="degree">Department of Computer Science and Engineering</span></h3>
+                                        <h2><?php echo $FullName; ?><span class="degree">
+                                                <?php if ($Title == "Dr.") {
+                                                    echo ', PhD';
+                                                } ?>
+                                            </span></h2>
+                                        <h3><span class="degree"><?php echo $Designation; ?></span></h3>
 
                                     </div>
                                 </a>

+ 3 - 1
single-faculty.php

@@ -99,7 +99,9 @@ get_header(); ?>
 							<h1 class="profile-name">
 								<?php echo $employeeInfo[0]['Title'];
 								echo " " . $employeeInfo[0]['FullName'];
-								?>
+								?><span class="degree"><?php if ($employeeInfo[0]['Title'] == "Dr.") {
+															echo ', PhD';
+														} ?></span>
 							</h1>
 							<h2 class="profile-des">
 								<?php echo $employeeInfo[0]['Designation'];