Browse Source

faculty profile 20

Rousnay 1 year ago
parent
commit
cd6eaa5a95
1 changed files with 25 additions and 25 deletions
  1. 25 25
      single-faculty.php

+ 25 - 25
single-faculty.php

@@ -10,36 +10,36 @@ get_header(); ?>
 
 <?php while (have_posts()) : the_post();
 
-	// $post_blocks = parse_blocks(get_the_content('', false, 166));
+	$post_blocks = parse_blocks(get_the_content('', false, 166));
 
-	// foreach ($post_blocks as $block) {
-	// 	if ('acf/faculty_member' != $block['faculty_member']) {
-	// 		continue;   // Skip this block if it's not the right block type
-	// 	}
+	foreach ($post_blocks as $block) {
+		if ('acf/faculty_member' != $block['faculty_member']) {
+			continue;   // Skip this block if it's not the right block type
+		}
 
-	// 	if (isset($block['attrs']['id'])) {
-	// 		$my_block_id = $block['attrs']['id'];
-	// 		break;  // Found a hit, get out of the loop
-	// 	}
+		if (isset($block['attrs']["data"]["login_id"])) {
+			$my_block_id = $block['attrs']["data"]["login_id"];
+			break;  // Found a hit, get out of the loop
+		}
 
-	// 	var_dump($my_block_id);
+		var_dump($my_block_id);
+	}
+
+	// if (function_exists('get_field')) {
+	// 	$pid = get_post();
+	// 	if (has_blocks($pid_content)) {
+	// 		$blocks = parse_blocks($pid->post_content);
+	// 		var_dump($blocks);
+	// 		foreach ($blocks as $block) {
+	// 			var_dump($block);
+	// 			if ($block["blockName"] == "acf/faculty-member") {
+	// 				echo "got it";
+	// 				echo $block["attrs"]["data"]["login_id"];
+	// 			}
+	// 		}
+	// 	}
 	// }
 
-	if (function_exists('get_field')) {
-		$pid = get_post();
-		if (has_blocks($pid_content)) {
-			$blocks = parse_blocks($pid->post_content);
-			var_dump($blocks);
-			foreach ($blocks as $block) {
-				var_dump($block);
-				if ($block["blockName"] == "acf/faculty-member") {
-					echo "got it";
-					echo $block["attrs"]["data"]["login_id"];
-				}
-			}
-		}
-	}
-
 
 ?>