HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/8.2.20
System: Linux 825a8fd6cf8c 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User: apache (48)
PHP: 8.2.20
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/themes/frameMyrskyNew/myrsky_media2.php
<?php
/**
 * @package WordPress
 * @subpackage frameMyrsky_Theme
 */
/*
Template Name: Myrsky MediaII 
*/
?>
<?php get_header() ?>
<?php /* if (have_posts()) : while (have_posts()) : the_post(); 
						$erp_page_path = get_the_content(); 

				 		wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));

		 			endwhile; endif; 
					echo "http://".$_SERVER['SERVER_NAME'].'/'.$erp_page_path; 
			*/
	$post_parent = $_GET["post_parent"] ? $_GET["post_parent"] : $post->ID  ;
	$post_id = $_GET["post_id"] ? $_GET["post_id"] : $post->ID  ;
	
	$args = array(   
		   'post_type' => 'page',   
		   'numberposts' => -1,   
		   'post_status' => null,
			'orderby' => 'menu_order',
			'order' => 'ASC',	   
		   'post_parent' => $post_parent  
		   );   
		   
	$pages = get_posts($args);  	
?> 
<div class="myrsky_body3">
<table>
<tr>
<td class="left_td">
<div class="left">
<div class="sidebar">
	<div class="sidebar_menu">
		<ul>
			<?php get_sidebar(); ?>
		</ul>
	</div>	
</div>	
</div>	
</td>
<td class="right_td">
<div class="right_content">  
	<?php 
		include("breadcrumb.php");
	?>
	<div id="box_top">
		<div class="font14b_whrite">&nbsp;<?php the_title(); ?></div>
	</div>
	<?php 
	/*		if (have_posts()) : while (have_posts()) : $s = the_post(); 
						echo get_the_content(); 

				 		wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));

		 			endwhile; endif;
	*/
	$post_id = $post->ID ;
	$post_parent = $_GET["post_parent"] ? $_GET["post_parent"] : $post->ID  ;
		
	$args = array(
		   'post_type' => 'attachment',   
		   'numberposts' => -1,   
		   'post_status' => null,   
		   'post_parent' => $post_id   
		   );   
		   
	$attachments = get_posts($args);  

	//分页

	$total_record_count = -1;
	if($attachments)$total_record_count = count($attachments);		
	$pageSize  = 9;
	if(fmod($total_record_count,$pageSize)){
		$pageCount = intval($total_record_count/$pageSize) + 1;
	}else{
		$pageCount = intval($total_record_count/$pageSize) ;
	}
	$page      = $_GET["page"] ? $_GET["page"]:1;
	$showCount = 8; 
	$PrevPage = $page-1;
	if ($PrevPage>=1){		
		$Prev = "<span><a href='?post_id=$post_id&page=$PrevPage'>上一页</a></span>";
	}else{
		$Prev = '<span>上一页</span>';
	}
	//$Tpl->SetVar("Prev",$Prev);
	$nextPage = $page+1;
	if ($nextPage>0 && ($nextPage<=$pageCount)){		
		$Next = "<span><a href='?post_id=$post_id&page=$nextPage'>下一页</a></span>";
	}else{
		$Next = '<span>下一页</span>';
	}
	//$Tpl->SetVar("Next",$Next);
	if($pageCount<$showCount){
		$pageB=1;
		$pageE=$pageCount;
	}else if($pageCount>=$showCount){
		if($page-$showCount/2 <=0){
			$pageB = 1;
			$pageE = $showCount;
		}else{	
			$pageB = $page-($showCount/2);		
			$pageE = $page+($showCount/2);	
		}
	}
	$pageDH = '';
	for($i=$pageB;$i<=$pageE;$i++){	
		if($page == $i ){
			$pageDH .= "<td>$i</td>";
		}else{
			$pageDH .= "<td><a href='?post_id=$post_id&page=$i'>$i</a></td>";
		}
	}
	//$Tpl->SetVar("pageDH",$pageDH);
	$start_id = ($page-1)*$pageSize;	
	//$search_key = js_unescape($search_key);
	if(is_array($attachments)){
		$proList = array_slice($attachments,$start_id,$pageSize);
	}else{
		$proList = $attachments;
	}

					?>
		<div id="box_mid">
			<div class="led-box-body led_list">
			<?php
			if ($proList){   
				foreach ($proList as $attachment) {    
				 // echo apply_filters('the_title', $attachment->post_title); 
				//$s = get_metadata($post_id,"_wp_attachment_image_alt","Product");
				//echo  bloginfo('url');
				//var_dump($s);
				// var_dump($attachment);die;
				 ?>
				
					<ul class="pro_list">
					<li>
					<a href="<?php echo $attachment->guid;?>" title="<?php echo $attachment->post_title;?>"  target="_blank"><img  alt="<?php echo $attachment->post_title;?>" src="<?php echo $attachment->guid;?>"/></a>
					<a href="<?php echo $attachment->guid;?>" title="<?php echo $attachment->post_content;?>"  target="_blank"><?php echo $attachment->post_title;?></a>
					</li>
					</ul>
				
				 <?php 
				 // the_attachment_link($attachment->ID, false);   
				  }
				  ?>
				<div style="clear:both;"></div>
				<div class="pagination">
				  <table cellPadding="0"  cellSpacing="0">
					<tr>
					  <td class="esp"><?php echo $Prev;?></td>
					  <?php echo $pageDH;?>
					  <td class="esp"><?php echo $Next;?></td>
					</tr>
				  </table>
				</div>
			<?php 
			}else{
				echo "<p style=\"padding-top:40px;padding-left:40px;font-family:bold;color:gray;font-size:16px;\">"._("该栏目还未添加内容")."</p>";			
			} 
			?>
		</div>
	
	
		</div>
		<div style="clear:both;"></div>
		<div id="box_bottom">&nbsp;</div>
    		
	</div>  
</div>  
</td>
</tr>
</table>
</div>  

<?php get_footer() ?>