php 6个Block-post小部件区域 - 类似于Agency-Pro

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 6个Block-post小部件区域 - 类似于Agency-Pro相关的知识,希望对你有一定的参考价值。

// Styles for home featured posts, a slightly modified version of the agency pro stylesheet
// Source: benweiser.com
.home-featured-posts .featuredpost .post:nth-of-type(3n+1) {
  clear: left;
}

.home-featured-posts {
	  padding: 10% 0 5%;
}

.home-featured-posts .wrap {
	max-width:1140px;
}

.featured-posts-home .content .featuredpost .entry {
  background: none;
  float: left;
  width: 33.33334%;
}

.featured-posts-home .content .featured-content .entry {
  border-radius: 0;
  margin: 0;
  border:0;
  padding: 0;
  position: relative;
}

.home-featured-posts .featuredpost .entry {
  min-height: 380px;
}

.featured-posts-home .content .featured-content .entry-header {
  padding: 40px 40px 0;
}

.featured-posts-home .content .featured-content .entry-content {
  padding: 0 40px;
}

.featured-posts-home .content .featuredpost img.entry-image {
  margin: 0;
  width:100%;
  height:100%;
}

.featured-posts-home .content .featured-content .entry-image {
  display: block;
  margin-bottom: 0;
}

.home-featured-posts .featuredpost img:hover {
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=10)";
  filter: alpha(opacity=10);
  -moz-opacity: 0.1;
  -khtml-opacity: 0.1;
  opacity: 0.1;
}

.home-featured-posts .featuredpost img.entry-image {
  left: 0;
  position: absolute;
}

.featured-posts-home .featured-content img {
-webkit-transition: all 0.2s ease-in-out;
  -moz-transition: all 0.2s ease-in-out;
  -ms-transition: all 0.2s ease-in-out;
  -o-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
}

.featured-posts-home .content .featured-content, .featured-posts-home .content .widget_text {
  padding: 0;
}

.featured-posts-home .content .widget {
	padding:0;
}

.home-featured-posts .widget-title {
	text-align:center;
}

.featured-posts-home .entry:before, 
.featured-posts-home .entry-content:before,
.featured-posts-home .entry:after, 
.featured-posts-home .entry-content:after {
	display:block;
}



@media only screen and (max-width: 1180px) {

.home-featured-posts .wrap {
		max-width: 960px;
	}



.home-featured-posts .featuredpost .entry {
		min-height: 320px;
	}


}


@media only screen and (max-width: 1023px) {

.home-featured-posts .wrap {
	max-width:760px;
}


.featured-posts-home .content .featuredpost .entry {
  min-height: 380px;
  width: 50%;
	}

.home-featured-posts .featured-content .post:nth-of-type(2n+1) {
  clear: left;
	}

.home-featured-posts .featured-content .post:nth-of-type(3n+1) {
  clear: none;
	}
}



@media only screen and (max-width: 680px) {
	.home-featured-posts .wrap {
		max-width:380px;
	}

	.featured-posts-home .content .featuredpost .entry {
		min-height: 380px;
		width: 100%;
	}
	
	.home-featured-posts .content .featured-content .entry-header {
		clear: both;
	}
	
}


@media only screen and (max-width: 480px) {
	
	.home-featured-posts .featuredpost img.entry-image {
		position: relative;
	}
	
	.home-featured-posts .featuredpost .entry img:hover {
		  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
		  filter: alpha(opacity=90);
		  -moz-opacity: 0.9;
		  -khtml-opacity: 0.9;
		  opacity: 0.9;
	}	

}
<?php
// Copy and paste this code in front-page.php benweiser.com

//* Add body class for custom CSS styles
add_filter( 'body_class', 'bw_home_body_class' );
function bw_home_body_class( $classes ) {
	$classes[] = 'featured-posts-home';
	return $classes;
}


// Define a function for displaying the widget area on the front-page.php
function bw_home_widget_areas(){
		genesis_widget_area( 'home-featured-posts', array(
			'before' => '<div class="home-featured-posts widget-area"><div class="wrap">',
			'after' => '</div></div>',
	) );

}

// Check if the home widget area is being used if so do the following..
if (is_active_sidebar('home-featured-posts') ) {
		// Force full-width-content layout setting
		add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );

		// Remove breadcrumbs
		remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );

		// Remove the default Genesis loop
		remove_action( 'genesis_loop', 'genesis_do_loop' );
		
		// Add home widget areas
		add_action('genesis_loop', 'bw_home_widget_areas');
}

// Note if you did not create a brand new front-page.php omit the following line of code since your existing file should contain it
genesis();
// Adds Home Featured Image Size
add_image_size( 'home-featured-post', 380, 380, TRUE );

// Register home featured posts widget area add this to functions.php
genesis_register_sidebar( array(
	'id'            => 'home-featured-posts',
	'name'          => __( 'Home Featured Posts', 'themename' ),
	'description'   => __( 'This is a widget area that is the home featured posts', '' ),
) );

以上是关于php 6个Block-post小部件区域 - 类似于Agency-Pro的主要内容,如果未能解决你的问题,请参考以下文章

php [WordPress] [functions]为活动菜单位置和活动小部件区域添加正文类。回复这篇文章(

php [WordPress] [functions]为活动菜单位置和活动小部件区域添加正文类。回复这篇文章(

通过php添加并显示自定义标题小部件区域

php 自定义小部件区域

php 注册照片网格的小部件区域。

php 自定义小部件区域生成器