Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'wp_enqueue_scripts', 'enqueue_backstretch' );
- function enqueue_backstretch() {
- wp_enqueue_script( 'backstretch', '/wp-content/uploads/dynamik-gen/skins/rowgen/js/backstretch.js', array( 'jquery' ), '1.0.0', true );
- wp_enqueue_script( 'backstretch-set', '/wp-content/uploads/dynamik-gen/skins/rowgen/js/backstretch-set.js' , array( 'jquery', 'backstretch' ), '1.0.0', true );
- }
- // Force full width content layout setting
- add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
- remove_action( 'genesis_loop', 'genesis_do_loop' );
- add_action( 'genesis_loop', 'rows_do_loop' );
- // Outputs a custom loop
- function rows_do_loop() {
- //* Localize backstretch script
- add_action( 'genesis_entry_header', 'rows_set_background_image', 4 );
- function rows_set_background_image() {
- global $images;
- global $row_ids;
- if ( has_post_thumbnail() ) {
- $image = array( 'src' => has_post_thumbnail() ? genesis_get_image( array( 'format' => 'url' ) ) : '' );
- $images[] = $image;
- $row_id = get_the_id();
- $row_ids[] = ".post-".$row_id;
- }
- }
- //* Remove the entry meta in the entry header
- remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
- //* Remove the post meta function
- remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
- $include = genesis_get_option( 'blog_cat' );
- $exclude = genesis_get_option( 'blog_cat_exclude' ) ? explode( ',', str_replace( ' ', '', genesis_get_option( 'blog_cat_exclude' ) ) ) : '';
- global $paged;
- $query_args = wp_parse_args(
- genesis_get_custom_field( 'query_args' ),
- array(
- 'cat' => $include,
- 'category__not_in' => $exclude,
- 'showposts' => genesis_get_option( 'blog_cat_num' ),
- 'paged' => $paged,
- 'post_type' => array( 'row' ),
- )
- );
- genesis_custom_loop( $query_args );
- }
- add_action( 'genesis_entry_header', 'output_cdata', 5 );
- function output_cdata() {
- global $images;
- $json_images = json_encode($images);
- $params = array('images' => $json_images,);
- wp_localize_script( 'backstretch-set', 'BackStretchImgs', $params );
- global $row_ids;
- $json_ids = json_encode($row_ids);
- $idparams = array('row_ids' => $json_ids,);
- wp_localize_script( 'backstretch-set', 'BackStretchIDs', $idparams );
- }
- genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement