Skip to content

Instantly share code, notes, and snippets.

@MatRouault
Created October 3, 2016 20:51
Show Gist options
  • Save MatRouault/e723b07062a87ca8e7382f6e8c6bd098 to your computer and use it in GitHub Desktop.
Save MatRouault/e723b07062a87ca8e7382f6e8c6bd098 to your computer and use it in GitHub Desktop.
Fullwidth post with featured image with overlay effect
<?php
add_action( 'wp', 'sps_custom_output' );
function sps_custom_output() {
if ( is_singular ( array ('post') ) ) {
/* Featured Image with Background Effect */
beans_add_attribute( 'beans_post_header', 'class', 'uk-cover-background uk-position-relative uk-contrast' );
beans_modify_action_hook( 'beans_post_image', 'sps_header_flex_before_markup' );
beans_wrap_inner_markup( 'beans_post_header', 'sps_header_flex', 'div', array(
'class' => 'uk-grid uk-position-cover uk-flex uk-flex-center uk-flex-bottom',
) );
beans_wrap_inner_markup( 'beans_post_header', 'sps_header_flex_inner', 'div', array(
'class' => 'uk-width-small-1-1 uk-width-medium-4-6 uk-width-large-4-6 uk-margin-large-bottom',
) );
/* Remove Useless Markup */
beans_remove_markup( 'beans_main_grid' );
beans_remove_markup( 'beans_primary' );
beans_remove_markup( 'beans_fixed_wrap[_main]' );
/* Wrap Post Body in a Container Center Markup */
beans_wrap_markup( 'beans_post_body', 'sps_post_body_markup', 'div', array(
'class' => 'uk-grid',
) );
/* Centered Layout For Post */
beans_add_attribute( 'beans_content', 'class', 'uk-container uk-container-center' );
beans_add_attribute( 'beans_post_body', 'class', 'uk-container-center uk-width-small-1-1 uk-width-medium-4-6 uk-width-large-4-6' );
/* Image and Oembed Media */
//beans_remove_attribute( 'beans_post_image', 'class', 'tm-article-image' );
beans_add_attribute( 'beans_embed_oembed', 'class', 'uk-align-medium-right uk-responsive-width' );
/* Change Default Featured Image Size */
add_filter( 'beans_edit_post_image_args', 'sps_post_image_edit_args' );
function sps_post_image_edit_args( $args ) {
return array_merge( $args, array(
'resize' => array( 1260, 600, true ),
) );
}
/* Text */
beans_add_attribute( 'beans_post_content', 'class', 'uk-text-large' );
/* Comments */
beans_wrap_inner_markup( 'beans_comments', 'sps_add_comment_markup', 'div', array(
'class' => 'uk-grid',
) );
beans_wrap_inner_markup( 'beans_comments', 'sps_add_comment_markup', 'div', array(
'class' => 'uk-container-center uk-width-small-1-1 uk-width-medium-4-6 uk-width-large-4-6',
) );
beans_add_attribute( 'beans_comment_form_submit', 'class', 'uk-button-large uk-width-1-1' );
/* Gallery : Caption in Overlay Effect */
beans_add_attribute( 'beans_post_gallery', 'class', 'uk-grid-small' );
beans_wrap_inner_markup( 'beans_post_gallery_item', 'sps_overlay_gallery', 'div', array(
'class' => 'uk-overlay uk-overlay-hover',
) );
beans_remove_markup( 'beans_post_gallery_icon' );
beans_add_attribute( 'beans_post_gallery_caption', 'class', 'uk-overlay-panel uk-overlay-background uk-overlay-bottom uk-overlay-fade' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment