Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Set up Masonry on non-handhelds
- add_action( 'wp_enqueue_scripts', 'sk_enqueue_scripts' );
- function sk_enqueue_scripts() {
- if ( wp_is_mobile() ) {
- return;
- }
- // Enqueue Masonry
- wp_enqueue_script( 'masonry' );
- // Enqueue Infinite Scroll
- wp_enqueue_script( 'infinite-scroll', get_stylesheet_directory_uri() . '/js/jquery.infinitescroll.min.js' , array( 'jquery' ), '2.1.0', true );
- // Initialize Masonry and Infinite Scroll
- wp_enqueue_script( 'masonry-infinite-scroll-init', get_stylesheet_directory_uri() . '/js/masonry-infinitescroll-single-init.js' , array( 'jquery' ), '1.0', true );
- }
- add_action( 'genesis_after_content', 'sk_all_posts_masonry' );
- function sk_all_posts_masonry() {
- // Force Content Limit regardless of Content Archive theme settings
- add_filter( 'genesis_pre_get_option_content_archive', 'sk_show_full_content' );
- add_filter( 'genesis_pre_get_option_content_archive_limit', 'sk_content_limit' );
- // Modify the Genesis content limit read more link
- add_filter( 'get_the_content_more_link', 'sp_read_more_link' );
- // Remove author and comment link in entry header's entry meta
- add_filter( 'genesis_post_info', 'sp_post_info_filter' );
- // Display Featured image linking to entry
- add_action( 'genesis_entry_header', 'sk_image', 9 );
- // Reposition Archive Pagination
- // remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );
- // add_action( 'genesis_after_content_sidebar_wrap', 'genesis_posts_nav' );
- add_action( 'wp_head', 'sk_hide_archive_pagination_desktops' );
- // accepts any wp_query args
- $args = (array(
- 'paged' => $paged,
- 'posts_per_page' => 4
- ));
- echo '<div class="all-posts">';
- genesis_custom_loop( $args );
- echo '</div>';
- }
- function sk_show_full_content() {
- return 'full';
- }
- function sk_content_limit() {
- return '100'; // Limit content to 100 characters
- }
- function sp_read_more_link() {
- return '... <a class="more-link" href="' . get_permalink() . '">read more</a>';
- }
- function sp_post_info_filter( $post_info ) {
- $post_info = '[post_date] [post_edit]';
- return $post_info;
- }
- function sk_image() {
- $image_args = array(
- 'size' => 'masonry-thumb'
- );
- // Get the featured image HTML
- $image = genesis_get_image( $image_args );
- printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $image );
- }
- function sk_hide_archive_pagination_desktops() {
- if ( wp_is_mobile() ) {
- return;
- } ?>
- <style type="text/css">
- .masonry-page .archive-pagination {
- display: none;
- }
- </style>
- <?php
- }
- genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement