Guest User

circle urbana

a guest
Mar 27th, 2014
95
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //* Start the engine
  3. include_once( get_template_directory() . '/lib/init.php' );
  4.  
  5. //* Child theme (do not remove)
  6. define( 'CHILD_THEME_NAME', 'Genesis Sample Theme' );
  7. define( 'CHILD_THEME_URL', 'http://www.studiopress.com/' );
  8. define( 'CHILD_THEME_VERSION', '2.0.1' );
  9.  
  10. //* Enqueue Lato Google font
  11. add_action( 'wp_enqueue_scripts', 'genesis_sample_google_fonts' );
  12. function genesis_sample_google_fonts() {
  13. wp_enqueue_style( 'google-font-lato', '//fonts.googleapis.com/css?family=Lato:300,700', array(), CHILD_THEME_VERSION );
  14. }
  15.  
  16. //* Add HTML5 markup structure
  17. add_theme_support( 'html5' );
  18.  
  19. //* Add viewport meta tag for mobile browsers
  20. add_theme_support( 'genesis-responsive-viewport' );
  21.  
  22. //* Add support for custom background
  23. add_theme_support( 'custom-background' );
  24.  
  25. //* Add support for 3-column footer widgets
  26. add_theme_support( 'genesis-footer-widgets', 3 );
  27.  
  28. //* Display a custom favicon
  29. add_filter( 'genesis_pre_load_favicon', 'sp_favicon_filter' );
  30. function sp_favicon_filter( $favicon_url ) {
  31. return 'http://localhost/Circleurbana/wp-content/themes/genesis-sample/images/favicon.ico';
  32. }
  33.  
  34. //* Add post navigation (requires HTML5 theme support)
  35. add_action( 'genesis_entry_footer', 'genesis_prev_next_post_nav' );
  36.  
  37. //* Customize the next page link
  38. add_filter ( 'genesis_next_link_text' , 'sp_next_page_link' );
  39. function sp_next_page_link ( $text ) {
  40. return __( 'Custom Next Page Link', CHILD_DOMAIN ) . g_ent( ' &raquo;' );
  41. }
  42.  
  43. //* Display author box on single posts
  44. add_filter( 'get_the_author_genesis_author_box_single', '__return_true' );
  45.  
  46. //* Change the footer text
  47. add_filter('genesis_footer_creds_text', 'sp_footer_creds_filter');
  48. function sp_footer_creds_filter( $creds ) {
  49. $creds = '[footer_copyright] &middot; <a href="http://circleurbana.com">Circle Urbana</a> &middot; Built on the Genesis Framework by Santosh Vallury';
  50. return $creds;
  51. }
  52.  
  53. //** Read More changed to Continue Reading...
  54.  
  55. add_filter( 'excerpt_more', 'child_read_more_link' );
  56. add_filter( 'get_the_content_more_link', 'child_read_more_link' );
  57. add_filter( 'the_content_more_link', 'child_read_more_link' );
  58. function child_read_more_link() {
  59. return '&#x2026; <a class="more-link" href="' . get_permalink() . '" rel="nofollow">Continue Reading &#x2026;</a>';
  60. }
  61.  
  62. //* Enqueue and initialize jQuery Masonry script
  63. add_action( 'wp_enqueue_scripts', 'sk_masonry_script' );
  64. function sk_masonry_script() {
  65.  
  66. if ( is_singular( 'post' ) ) {
  67.  
  68. wp_enqueue_script( 'masonry-init', get_stylesheet_directory_uri().'/js/masonry-init.js', array( 'jquery-masonry' ), '1.0', true );
  69.  
  70. }
  71.  
  72. }
  73.  
  74. //* Define custom image size for featured image in Related Posts
  75. add_image_size( 'related', 300, 0, true );
  76.  
  77.  
  78. add_action( 'genesis_after_entry_content', 'child_related_posts' );
  79. /**
  80. * Outputs related posts with thumbnail
  81. *
  82. * @author Nick the Geek
  83. * @url http://designsbynickthegeek.com/tutorials/related-posts-genesis
  84. * @global object $post
  85. */
  86. function child_related_posts() {
  87.  
  88. if ( is_singular ( 'post' ) ) {
  89.  
  90. global $post;
  91.  
  92. $count = 0;
  93. $postIDs = array( $post->ID );
  94. $related = '';
  95. $tags = wp_get_post_tags( $post->ID );
  96. $cats = wp_get_post_categories( $post->ID );
  97.  
  98. if ( $tags ) {
  99.  
  100. foreach ( $tags as $tag ) {
  101.  
  102. $tagID[] = $tag->term_id;
  103.  
  104. }
  105.  
  106. $args = array(
  107. 'tag__in' => $tagID,
  108. 'post__not_in' => $postIDs,
  109. 'showposts' => 8,
  110. 'ignore_sticky_posts' => 1,
  111. 'tax_query' => array(
  112. array(
  113. 'taxonomy' => 'post_format',
  114. 'field' => 'slug',
  115. 'terms' => array(
  116. 'post-format-link',
  117. 'post-format-status',
  118. 'post-format-aside',
  119. 'post-format-quote'
  120. ),
  121. 'operator' => 'NOT IN'
  122. )
  123. )
  124. );
  125.  
  126. $tag_query = new WP_Query( $args );
  127.  
  128. if ( $tag_query->have_posts() ) {
  129.  
  130. while ( $tag_query->have_posts() ) {
  131.  
  132. $tag_query->the_post();
  133.  
  134. // $img = genesis_get_image() ? genesis_get_image( array( 'size' => 'related' ) ) : '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/related.png" alt="' . get_the_title() . '" />';
  135. $img = genesis_get_image( array( 'size' => 'related' ) );
  136.  
  137. $related .= '<div class="related-post"><a href="' . get_permalink() . '" rel="bookmark" title="Permanent Link to' . get_the_title() . '">' . $img . get_the_title() . '</a></div>';
  138.  
  139. $postIDs[] = $post->ID;
  140.  
  141. $count++;
  142. }
  143. }
  144. }
  145.  
  146. if ( $count <= 7 ) {
  147.  
  148. $catIDs = array( );
  149.  
  150. foreach ( $cats as $cat ) {
  151.  
  152. if ( 6 == $cat )
  153. continue;
  154. $catIDs[] = $cat;
  155.  
  156. }
  157.  
  158. $showposts = 8 - $count;
  159.  
  160. $args = array(
  161. 'category__in' => $catIDs,
  162. 'post__not_in' => $postIDs,
  163. 'showposts' => $showposts,
  164. 'ignore_sticky_posts' => 1,
  165. 'orderby' => 'rand',
  166. 'tax_query' => array(
  167. array(
  168. 'taxonomy' => 'post_format',
  169. 'field' => 'slug',
  170. 'terms' => array(
  171. 'post-format-link',
  172. 'post-format-status',
  173. 'post-format-aside',
  174. 'post-format-quote' ),
  175. 'operator' => 'NOT IN'
  176. )
  177. )
  178. );
  179.  
  180. $cat_query = new WP_Query( $args );
  181.  
  182. if ( $cat_query->have_posts() ) {
  183.  
  184. while ( $cat_query->have_posts() ) {
  185.  
  186. $cat_query->the_post();
  187.  
  188. // $img = genesis_get_image() ? genesis_get_image( array( 'size' => 'related' ) ) : '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/related.png" alt="' . get_the_title() . '" />';
  189. $img = genesis_get_image( array( 'size' => 'related' ) );
  190.  
  191. $related .= '<div class="related-post"><a href="' . get_permalink() . '" rel="bookmark" title="Permanent Link to' . get_the_title() . '">' . $img . get_the_title() . '</a></div>';
  192. }
  193. }
  194. }
  195.  
  196. if ( $related ) {
  197.  
  198. printf( '<div class="related"><h3 class="related-title">Related Posts</h3><div class="related-posts-list" data-columns>%s</div></div>', $related );
  199.  
  200. }
  201.  
  202. wp_reset_query();
  203.  
  204. }
  205. }
  206.  
  207. //* Register Home Slider widget area
  208. genesis_register_sidebar( array(
  209. 'id' => 'home-parallax-section',
  210. 'name' => __( 'Home Parallax Section', 'your-theme-slug' ),
  211. 'description' => __( 'This is the home parallax widget area.', 'your-theme-slug' ),
  212. ) );
  213.  
  214. //* Display Home Parallax Section below Header (+Nav)
  215. add_action ( 'genesis_after_header', 'sk_parallax_section' );
  216. function sk_parallax_section() {
  217.  
  218. if ( ! ( is_home() || is_front_page() ) )
  219. return;
  220.  
  221. genesis_widget_area( 'home-parallax-section', array(
  222. 'before' => '<div id="home-parallax-section" class="parallax-section" data-stellar-background-ratio="0.5"><div class="wrap"',
  223. 'after' => '</div></div>',
  224. ) );
  225.  
  226. }
  227.  
  228. add_action( 'wp_enqueue_scripts', 'sk_enqueue_scripts' );
  229. function sk_enqueue_scripts() {
  230.  
  231. if ( is_home() ) {
  232.  
  233. wp_enqueue_style( 'animate', get_stylesheet_directory_uri() . '/css/animate.min.css' );
  234.  
  235. // load Waypoints
  236. // Source: http://imakewebthings.com/jquery-waypoints/
  237. wp_enqueue_script( 'waypoints', get_stylesheet_directory_uri() . '/js/waypoints.min.js', array( 'jquery' ), '1.0.0' );
  238.  
  239. wp_enqueue_script( 'waypoints-init', get_stylesheet_directory_uri() .'/js/waypoints-init.js' , array( 'jquery', 'waypoints' ), '1.0.0' );
  240.  
  241. }
  242.  
  243. }
  244.  
  245. //* Sticky Header
  246.  
  247. add_action( 'wp_enqueue_scripts', 'custom_enqueue_script' );
  248. function custom_enqueue_script() {
  249. wp_enqueue_script( 'sticky-nav', get_bloginfo( 'stylesheet_directory' ) . '/js/sticky-nav.js', array( 'jquery' ), '', true );
  250. }
  251.  
  252. //* Adding Google Translator to Primary Nav Menu
  253.  
  254. add_filter( 'genesis_nav_items', 'sk_google_translator', 10, 2 );
  255. add_filter( 'wp_nav_menu_items', 'sk_google_translator', 10, 2 );
  256.  
  257. function sk_google_translator($menu, $args) {
  258. $args = (array)$args;
  259. if ( 'primary' !== $args['theme_location'] )
  260. return $menu;
  261. ob_start();
  262. echo '<div id="google-translator">' . do_shortcode("[google-translator]") . '</div>';
  263. $google_translator = ob_get_clean();
  264. return $menu . $google_translator;
  265. }
  266.  
  267.  
  268. //* Fade in side bar widget
  269.  
  270. add_action( 'wp_enqueue_scripts', 'enqueue_sticky_last_widget' );
  271. function enqueue_sticky_last_widget() {
  272.  
  273. wp_enqueue_style( 'animate', get_stylesheet_directory_uri() . '/css/animate.min.css' );
  274.  
  275. wp_enqueue_script( 'waypoints', get_stylesheet_directory_uri() . '/js/waypoints.min.js', array( 'jquery' ), '1.0.0' );
  276. wp_enqueue_script( 'waypoints-initi', get_stylesheet_directory_uri() .'/js/waypoints-initi.js', array('jquery', 'waypoints' ), '1.0.0' );
  277. }
  278.  
  279. //* For Sliding-in Posts from left (Sridhar Katakam)
  280.  
  281. add_action( 'wp_enqueue_scripts', 'enqueue_scroll_animations' );
  282. function enqueue_scroll_animations() {
  283.  
  284. if ( is_handheld() )
  285. return;
  286.  
  287. wp_enqueue_style( 'animate', get_stylesheet_directory_uri() . '/css/animate.min.css' );
  288.  
  289. wp_enqueue_script( 'waypoints', get_stylesheet_directory_uri() . '/js/waypoints.min.js', array( 'jquery' ), '1.0.0' );
  290. wp_enqueue_script( 'waypoints-initp', get_stylesheet_directory_uri() .'/js/waypoints-initp.js' , array( 'jquery', 'waypoints' ), '1.0.0' );
  291.  
  292. }
RAW Paste Data