首页 css样式 head foot
<mip-link title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">
<mip-img
layout="responsive"
alt="<?php the_title(); ?>"
<?php
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(),'full');
$img_url_out = $large_image_url[0];
echo 'src="'.$img_url_out.'"';
$img_width = $img_url[1]; // Get the width
$img_height = $img_url[2]; // Get the height
echo 'width="'.$img_width.'"';
echo 'height="'.$img_height.'"';
?>">
</mip-img>
</mip-link>
'img' => 'mip-img layout="responsive"' ,
//详细页图片
function all_img($soContent){
$soImages = '~<img [^\>]*\ />~';
preg_match_all( $soImages, $soContent, $thePics );
$allPics = count($thePics);
if( $allPics > 0 ){
foreach($thePics[0] as $v){
}
}
else {
echo "没图片";
}
}
register_nav_menus( array(
'primary' => __( 'Primary Navigation'),
));
//详细页图片end
<?php all_img($post->post_content);?>
<?php
$img_id = get_post_thumbnail_id(337); // 35 being the ID of the Post
$img_url = wp_get_attachment_image_src($img_id,'full');
$img_url_out = $img_url[0];
echo 'src="'.$img_url_out.'"';
?>
<mip-link title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">
<mip-img
layout="responsive"
alt="<?php the_title(); ?>"
<?php
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
$img_url_out = $large_image_url[0];
echo 'src="'.$img_url_out.'"';
$img_width = $img_url[1]; // Get the width
$img_height = $img_url[2]; // Get the height
echo 'width="'.$img_width.'"';
echo 'height="'.$img_height.'"';
?>">
</mip-img>
</mip-link>
echo '<mip-link title="123" href="123">';
echo '<mip-img layout="responsive" alt="123123"';
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
$img_url_out = $large_image_url[0];
echo 'src="'.$img_url_out.'"';
$img_width = $img_url[1]; // Get the width
$img_height = $img_url[2]; // Get the height
echo 'width="'.$img_width.'"';
echo 'height="'.$img_height.'">';
echo '</mip-img>';
echo '</mip-link>';
发表评论 取消回复