Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active June 21, 2016 10:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save srikat/10587889 to your computer and use it in GitHub Desktop.
Save srikat/10587889 to your computer and use it in GitHub Desktop.
Featured Posts section similar to that in Agency Pro in any Genesis theme. http://sridharkatakam.com/add-featured-posts-section-similar-agency-pro-genesis-theme/
add_image_size( 'agency-like-featured-posts', 380, 380, TRUE );
genesis_register_sidebar( array(
'id' => 'agency-like-featured-posts',
'name' => __( 'Agency-like Featured Posts', 'theme-name' ),
'description' => __( 'This is the agency like featured posts section.', 'theme-name' ),
) );
add_action( 'genesis_after_header', 'sk_featured_posts' );
function sk_featured_posts() {
if ( is_front_page() ) {
genesis_widget_area( 'agency-like-featured-posts', array(
'before' => '<div class="agency-like-featured-posts widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
}
add_image_size( 'agency-like-featured-posts', 380, 380, TRUE );
genesis_register_sidebar( array(
'id' => 'agency-like-featured-posts',
'name' => __( 'Agency-like Featured Posts', 'theme-name' ),
'description' => __( 'This is the agency like featured posts section.', 'theme-name' ),
) );
if ( is_active_sidebar( 'home-widgets-1' ) || is_active_sidebar( 'home-widgets-2' ) || is_active_sidebar( 'home-widgets-3' ) || is_active_sidebar( 'home-widgets-4' ) || is_active_sidebar( 'home-widgets-5' ) || is_active_sidebar( 'home-widgets-6' ) ) {
if ( is_active_sidebar( 'home-widgets-1' ) || is_active_sidebar( 'home-widgets-2' ) || is_active_sidebar( 'home-widgets-3' ) || is_active_sidebar( 'home-widgets-4' ) || is_active_sidebar( 'home-widgets-5' ) || is_active_sidebar( 'home-widgets-6' ) || is_active_sidebar( 'agency-like-featured-posts' ) ) {
//* Remove the default Genesis loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
//* Add Featured Posts
add_action( 'genesis_loop', 'agency_like_featured_posts' );
function agency_like_featured_posts() {
genesis_widget_area( 'agency-like-featured-posts', array(
'before' => '<div class="agency-like-featured-posts widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
.site-header {
top: 0;
}
/* Featured Posts section similar to Agency Pro
------------------------------------------------------- */
.agency-like-featured-posts {
background-color: #fff;
padding-top: 50px;
padding-bottom: 50px;
}
.agency-like-featured-posts .wrap {
max-width: 1140px;
margin: 0 auto;
}
.agency-like-featured-posts .featuredpost img.entry-image {
left: 0;
position: absolute;
}
.agency-like-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;
}
.agency-like-featured-posts .featuredpost .entry {
background-color: #333;
color: #fff;
min-height: 380px;
float: left;
width: 33.33333333%;
border-bottom: none;
}
.agency-like-featured-posts .featuredpost .entry-title a {
color: #fff;
}
.agency-like-featured-posts .featuredpost {
padding: 0;
}
.agency-like-featured-posts .featuredpost .widget-title {
/*color: #fff;*/
text-align: center;
padding-bottom: 20px;
text-transform: uppercase;
}
.agency-like-featured-posts .featuredpost .widget-title::before,
.agency-like-featured-posts .featuredpost .widget-title::after {
content: " ";
display: inline-block;
/*border-top: 2px solid #fff;*/
border-top: 2px solid #333;
padding-bottom: 4px;
width: 15%;
}
.agency-like-featured-posts .featuredpost .widget-title::before {
margin-right: 12px;
}
.agency-like-featured-posts .featuredpost .widget-title::after {
margin-left: 12px;
}
.agency-like-featured-posts .featuredpost article ~ .widget-title {
clear: both;
color: #333;
margin: 0;
padding: 20px 0;
}
.agency-like-featured-posts .featuredpost article ~ .widget-title:before,
.agency-like-featured-posts .featuredpost article ~ .widget-title:after {
border-color: #333;
}
.agency-like-featured-posts .featuredpost article ~ ul,
.agency-like-featured-posts .featuredpost .more-from-category {
margin-bottom: 40px;
text-align: center;
}
.agency-like-featured-posts .featuredpost .entry {
border-radius: 0;
margin: 0;
padding: 0;
position: relative;
float: left;
width: 33.33333333%;
}
.agency-like-featured-posts .featuredpost .entry-image {
display: block;
margin-bottom: 0;
}
.agency-like-featured-posts .featuredpost .entry-header {
padding: 40px 40px 0;
}
.agency-like-featured-posts .featuredpost .entry-content {
padding: 0 40px;
}
.agency-like-featured-posts .featuredpost .entry-content p {
margin-bottom: 40px;
}
.agency-like-featured-posts .featuredpost a:hover {
color: #d7c603;
}
.agency-like-featured-posts .featuredpost img.entry-image {
margin: 0;
}
@media only screen and (max-width: 1024px) {
.agency-like-featured-posts .wrap {
padding-left: 5%;
padding-right: 5%;
}
.agency-like-featured-posts {
padding-bottom: 0;
}
.agency-like-featured-posts .featuredpost img.entry-image {
position: relative;
}
.agency-like-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;
}
.agency-like-featured-posts .featuredpost .entry {
color: #333;
background-color: #fff;
}
.agency-like-featured-posts .featuredpost .entry .alignnone {
margin-bottom: 0;
}
.agency-like-featured-posts .featuredpost .entry-header {
padding-top: 0;
}
.agency-like-featured-posts .featuredpost .entry-title {
margin-top: 20px;
}
.agency-like-featured-posts .featuredpost .entry-title a {
color: #333;
}
}
@media only screen and (max-width: 768px) {
.agency-like-featured-posts .featuredpost .entry-header,
.agency-like-featured-posts .featuredpost .entry-content {
padding-left: 10px;
padding-right: 10px;
}
}
@media only screen and (max-width: 568px) {
.agency-like-featured-posts .featuredpost .entry {
width: 100%;
text-align: center;
float: none;
}
.agency-like-featured-posts .featuredpost .entry .alignnone {
display: inline-block;
}
.agency-like-featured-posts .featuredpost .entry-header,
.agency-like-featured-posts .featuredpost .entry-content {
text-align: left;
}
}
@media only screen and (max-width: 320px) {
.agency-like-featured-posts .featuredpost .entry .alignnone {
display: inline;
}
.agency-like-featured-posts .featuredpost .entry-header,
.agency-like-featured-posts .featuredpost .entry-content {
padding: 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment