Advertisement
srikat

single.php

May 29th, 2015
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. <?php
  2.  
  3. // Set up Masonry on non-handhelds
  4. add_action( 'wp_enqueue_scripts', 'sk_enqueue_scripts' );
  5. function sk_enqueue_scripts() {
  6. if ( wp_is_mobile() ) {
  7. return;
  8. }
  9.  
  10. // Enqueue Masonry
  11. wp_enqueue_script( 'masonry' );
  12.  
  13. // Enqueue Infinite Scroll
  14. wp_enqueue_script( 'infinite-scroll', get_stylesheet_directory_uri() . '/js/jquery.infinitescroll.min.js' , array( 'jquery' ), '2.1.0', true );
  15.  
  16. // Initialize Masonry and Infinite Scroll
  17. wp_enqueue_script( 'masonry-infinite-scroll-init', get_stylesheet_directory_uri() . '/js/masonry-infinitescroll-single-init.js' , array( 'jquery' ), '1.0', true );
  18. }
  19.  
  20. add_action( 'genesis_after_content', 'sk_all_posts_masonry' );
  21. function sk_all_posts_masonry() {
  22. // Force Content Limit regardless of Content Archive theme settings
  23. add_filter( 'genesis_pre_get_option_content_archive', 'sk_show_full_content' );
  24. add_filter( 'genesis_pre_get_option_content_archive_limit', 'sk_content_limit' );
  25.  
  26. // Modify the Genesis content limit read more link
  27. add_filter( 'get_the_content_more_link', 'sp_read_more_link' );
  28.  
  29. // Remove author and comment link in entry header's entry meta
  30. add_filter( 'genesis_post_info', 'sp_post_info_filter' );
  31.  
  32. // Display Featured image linking to entry
  33. add_action( 'genesis_entry_header', 'sk_image', 9 );
  34.  
  35. // Reposition Archive Pagination
  36. // remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );
  37. // add_action( 'genesis_after_content_sidebar_wrap', 'genesis_posts_nav' );
  38.  
  39. add_action( 'wp_head', 'sk_hide_archive_pagination_desktops' );
  40.  
  41. // accepts any wp_query args
  42. $args = (array(
  43. 'paged' => $paged,
  44. 'posts_per_page' => 4
  45. ));
  46.  
  47. echo '<div class="all-posts">';
  48. genesis_custom_loop( $args );
  49. echo '</div>';
  50. }
  51.  
  52.  
  53. function sk_show_full_content() {
  54. return 'full';
  55. }
  56.  
  57. function sk_content_limit() {
  58. return '100'; // Limit content to 100 characters
  59. }
  60.  
  61. function sp_read_more_link() {
  62. return '... <a class="more-link" href="' . get_permalink() . '">read more</a>';
  63. }
  64.  
  65. function sp_post_info_filter( $post_info ) {
  66. $post_info = '[post_date] [post_edit]';
  67. return $post_info;
  68. }
  69.  
  70. function sk_image() {
  71. $image_args = array(
  72. 'size' => 'masonry-thumb'
  73. );
  74.  
  75. // Get the featured image HTML
  76. $image = genesis_get_image( $image_args );
  77.  
  78. printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $image );
  79. }
  80.  
  81. function sk_hide_archive_pagination_desktops() {
  82. if ( wp_is_mobile() ) {
  83. return;
  84. } ?>
  85. <style type="text/css">
  86. .masonry-page .archive-pagination {
  87. display: none;
  88. }
  89. </style>
  90. <?php
  91. }
  92.  
  93. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement