Advertisement
Guest User

child-theme

a guest
Aug 27th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.41 KB | None | 0 0
  1. function higher_education_featured_overall_image() {
  2. global $post, $wp_query;
  3. $options = higher_education_get_theme_options();
  4. $enable = $options['enable_featured_header_image'];
  5.  
  6. // Check Enable/Disable header image in Page/Post Meta box
  7. if ( is_singular() ) {
  8. //Individual Page/Post Image Setting
  9. $metabox_feat_img = get_post_meta( $post->ID, 'higher-education-header-image', true );
  10.  
  11. if ( 'disable' == $metabox_feat_img || ( 'default' == $metabox_feat_img && 'disabled' == $enable ) ) {
  12. echo '<!-- Page/Post Disable Header Image -->';
  13. return;
  14. } elseif ( 'enable' == $metabox_feat_img && 'disabled' == $enable ) {
  15. higher_education_featured_page_post_image();
  16. }
  17. }
  18.  
  19. // Get Page ID outside Loop
  20. $page_id = $wp_query->get_queried_object_id();
  21. $page_for_posts = get_option( 'page_for_posts' );
  22.  
  23. // Check Homepage
  24. if ( 'homepage' == $enable ) {
  25. if ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) {
  26. higher_education_featured_image();
  27. }
  28. } elseif ( 'exclude-home' == $enable ) {
  29. if ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) {
  30. return false;
  31. } else {
  32. higher_education_featured_image();
  33. }
  34. } elseif ( 'exclude-home-page-post' == $enable ) {
  35. if ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) {
  36. return false;
  37. } elseif ( is_singular() ) {
  38. higher_education_featured_page_post_image();
  39. } else {
  40. higher_education_featured_image();
  41. }
  42. } elseif ( 'entire-site' == $enable ) {
  43. higher_education_featured_image();
  44. } elseif ( 'entire-site-page-post' == $enable ) {
  45. if ( is_singular() ) {
  46. higher_education_featured_page_post_image();
  47. } else {
  48. higher_education_featured_image();
  49. }
  50. } elseif ( 'pages-posts' == $enable ) {
  51. if ( is_singular() ) {
  52. higher_education_featured_page_post_image();
  53. }
  54. } else {
  55. echo '<!-- Disable Header Image -->';
  56. }
  57.  
  58.  
  59. } // higher_education_featured_overall_image
  60.  
  61. add_action( 'higher_education_after_content', 'higher_education_featured_overall_image', 40 );
  62.  
  63. function higher_education_hero_content_display() {
  64. //higher_education_flush_transients();
  65. global $wp_query;
  66.  
  67. // get data value from options
  68. $options = higher_education_get_theme_options();
  69. $enable_content = $options['hero_content_option'];
  70. $content_select = $options['hero_content_type'];
  71.  
  72. // Front page displays in Reading Settings
  73. $page_for_posts = get_option( 'page_for_posts' );
  74.  
  75. // Get Page ID outside Loop
  76. $page_id = $wp_query->get_queried_object_id();
  77. if ( 'entire-site' == $enable_content || ( ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) && 'homepage' == $enable_content ) ) {
  78. if ( ( !$output = get_transient( 'higher_education_hero_content' ) ) ) {
  79. echo '<!-- refreshing cache -->';
  80.  
  81. $classes[] = $content_select ;
  82.  
  83. $output ='
  84. <div id="hero-section" class="sections ' . implode( ' ', $classes ) . '">
  85. <div class="wrapper">';
  86. // Select content
  87. if ( 'demo' == $content_select ) {
  88. $output .= higher_education_demo_hero_content();
  89. }
  90. elseif ( 'post' == $content_select || 'page' == $content_select || 'category' == $content_select ) {
  91. $output .= higher_education_post_page_category_hero_content( $options );
  92. }
  93. elseif ( 'image' == $content_select ) {
  94. $output .= higher_education_custom_hero_content( $options );
  95. }
  96.  
  97. $output .='
  98. </div><!-- .wrapper -->
  99. </div><!-- #hero-section -->';
  100.  
  101. set_transient( 'higher_education_hero_content', $output, 86940 );
  102. }
  103. echo $output;
  104. }
  105. }
  106. add_action( 'higher_education_after_content', 'higher_education_hero_content_display', 50 );
  107.  
  108.  
  109.  
  110.  
  111.  
  112. function higher_education_featured_content_display_position() {
  113. // Getting data from Theme Options
  114. $options = higher_education_get_theme_options();
  115.  
  116. if ( $options['featured_content_position'] ) {
  117. add_action( 'higher_education_after_content', 'higher_education_featured_content_display', 60 );
  118. }
  119. else {
  120. add_action( 'higher_education_before_content', 'higher_education_featured_content_display', 30 );
  121. }
  122. }
  123.  
  124. function higher_education_promotion_headline_display() {
  125. //higher_education_flush_transients();
  126. global $wp_query;
  127.  
  128. $options = higher_education_get_theme_options();
  129. $enable_content = $options['promotion_headline_option'];
  130. $content_select = $options['promotion_headline_type'];
  131.  
  132. // Front page displays in Reading Settings
  133. $page_for_posts = get_option( 'page_for_posts' );
  134.  
  135. // Get Page ID outside Loop
  136. $page_id = $wp_query->get_queried_object_id();
  137.  
  138. if ( 'entire-site' == $enable_content || ( ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) && 'homepage' == $enable_content ) ) {
  139. if ( ( !$output = get_transient( 'higher_education_promotion_headline' ) ) ) {
  140. echo '<!-- refreshing cache -->';
  141.  
  142. $classes[] = $content_select ;
  143.  
  144. $output ='
  145. <div id="promotion-section" class="sections ' . implode( ' ', $classes ) . '">
  146. <div class="wrapper">';
  147. // Select content
  148. if ( 'demo' == $content_select ) {
  149. $output .= higher_education_demo_promotion_headline();
  150. }
  151. elseif ( 'post' == $content_select || 'page' == $content_select || 'category' == $content_select ) {
  152. $output .= higher_education_post_page_category_promotion_headline( $options );
  153. }
  154. elseif ( 'custom' == $content_select ) {
  155. $output .= higher_education_custom_promotion_headline( $options );
  156. }
  157.  
  158. $output .='
  159. </div><!-- .wrapper -->
  160. </div><!-- #promotion-section -->';
  161.  
  162. set_transient( 'higher_education_promotion_headline', $output, 86940 );
  163. }
  164. echo $output;
  165. }
  166. }
  167. add_action( 'higher_education_after_content', 'higher_education_promotion_headline_display', 70 );
  168.  
  169. function higher_education_portfolio_display() {
  170. //higher_education_flush_transients();
  171. global $wp_query;
  172.  
  173. // get data value from options
  174. $options = higher_education_get_theme_options();
  175. $enable_content = $options['portfolio_option'];
  176. $content_select = $options['portfolio_type'];
  177.  
  178. // Front page displays in Reading Settings
  179. $page_for_posts = get_option( 'page_for_posts' );
  180.  
  181. // Get Page ID outside Loop
  182. $page_id = $wp_query->get_queried_object_id();
  183. if ( 'entire-site' == $enable_content || ( ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) && 'homepage' == $enable_content ) ) {
  184. if ( ( !$output = get_transient( 'higher_education_portfolio' ) ) ) {
  185. $layouts = $options['portfolio_layout'];
  186. $headline = $options['portfolio_headline'];
  187. $subheadline = $options['portfolio_subheadline'];
  188.  
  189. echo '<!-- refreshing cache -->';
  190.  
  191. if ( !empty( $layouts ) ) {
  192. $classes = $layouts ;
  193. }
  194.  
  195. $classes .= ' ' . $content_select;
  196.  
  197. if ( 'demo' == $content_select ) {
  198. $headline = esc_html__( 'Portfolio', 'higher-education-pro' );
  199. $subheadline = esc_html__( 'Here you can showcase the x number of Portfolios.', 'higher-education-pro' );
  200. }
  201.  
  202. $output ='
  203. <div id="portfolio-section" class="sections ' . $classes . '">
  204. <div class="wrapper">';
  205. if ( !empty( $headline ) || !empty( $subheadline ) ) {
  206. $output .='
  207. <div class="section-heading-wrap">';
  208. if ( !empty( $headline ) ) {
  209. if( class_exists( 'Polylang' ) ) {
  210. $output .='<h2 class="section-title">'. pll__( $headline ) .'</h2>';
  211. } else {
  212. $output .='<h2 class="section-title">'. $headline .'</h2>';
  213. }
  214. }
  215. if ( !empty( $subheadline ) ) {
  216. if( class_exists( 'Polylang' ) ) {
  217. $output .='<p>'. pll__( $subheadline ) .'</p>';
  218. } else {
  219. $output .='<p>' . wp_kses_post( $subheadline ) . '</p>';
  220. }
  221. }
  222. $output .='
  223. </div><!-- .section-heading-wrap -->';
  224. }
  225.  
  226. $output .='<div class="section-content-wrap">';
  227. // Select portfolio
  228. if ( 'demo' == $content_select ) {
  229. $output .= higher_education_demo_portfolio( $options );
  230. }
  231. elseif ( 'post' == $content_select || 'jetpack-portfolio' == $content_select || 'page' == $content_select || 'category' == $content_select ) {
  232. $output .= higher_education_post_page_category_portfolio( $options );
  233. }
  234. elseif ( 'image' == $content_select ) {
  235. $output .= higher_education_image_portfolio( $options );
  236. }
  237.  
  238. if ( $options['portfolio_more_button_link'] || $options['portfolio_more_button_text'] ) {
  239. $target = $options['portfolio_more_button_target'] ? '_blank' : '_self';
  240. $output .='<span class="readmore"><a target="' . $target . '" href="' . esc_url( $options['portfolio_more_button_link'] ) . '">' . esc_html( $options['portfolio_more_button_text'] ) . '</a></span>';
  241. }
  242.  
  243. $output .='
  244. </div><!-- .portfolio-content-wrap -->
  245. </div><!-- .wrapper -->
  246. </div><!-- .portfolio-section -->';
  247.  
  248. set_transient( 'higher_education_portfolio', $output, 86940 );
  249. }
  250.  
  251. echo $output;
  252. }
  253. } //higher_education_portfolio_display
  254. add_action( 'higher_education_after_content', 'higher_education_portfolio_display', 80 );
  255.  
  256. function higher_education_logo_slider() {
  257. //higher_education_flush_transients();
  258. global $wp_query;
  259.  
  260. // get data value from options
  261. $options = higher_education_get_theme_options();
  262. $enable_slider = $options['logo_slider_option'];
  263. $layout = $options['logo_slider_visible_items'];
  264. $slider_type = $options['logo_slider_type'];
  265.  
  266. // Get Page ID outside Loop
  267. $page_id = $wp_query->get_queried_object_id();
  268.  
  269. // Front page displays in Reading Settings
  270. $page_for_posts = get_option( 'page_for_posts' );
  271.  
  272. if ( 'entire-site' == $enable_slider || ( ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) && 'homepage' == $enable_slider ) ) {
  273. if ( ( !$output = get_transient( 'higher_education_logo_slider' ) ) ) {
  274. echo '<!-- refreshing cache -->';
  275.  
  276. if ( 1 == $layout ) {
  277. $class[] = 'layout-one';
  278. }
  279. elseif ( 2 == $layout ) {
  280. $class[] = 'layout-two';
  281. }
  282. elseif ( 3 == $layout ) {
  283. $class[] = 'layout-three';
  284. }
  285. elseif ( 4 == $layout ) {
  286. $class[] = 'layout-four';
  287. }
  288. elseif ( 5 == $layout ) {
  289. $class[] = 'layout-five';
  290. }
  291.  
  292.  
  293. $class[] = $slider_type;
  294.  
  295. $output = '
  296. <div id="logo-section" class="sections '. esc_attr( implode( ' ', $class ) ) .'">
  297. <div class="wrapper">';
  298. if ( '' != $options['logo_slider_title'] ) {
  299. if( class_exists( 'Polylang' ) ) {
  300. $options['logo_slider_title'] = pll__( $options['logo_slider_title'] );
  301. }
  302. $output .= '<h2 id="logo-slider-title" class="section-title">' . esc_html( $options['logo_slider_title'] ) . '</h2>';
  303. }
  304.  
  305. $output .= '
  306. <!-- prev/next links -->
  307. <!-- prev/next links -->
  308. <div class="cycle-prev"></div>
  309. <div class="cycle-next"></div>
  310.  
  311.  
  312. <div class="logo_slider_content_slider_wrap cycle-slideshow"
  313. data-cycle-log="false"
  314. data-cycle-pause-on-hover="true"
  315. data-cycle-swipe="true"
  316. data-cycle-fx=carousel
  317. data-cycle-carousel-fluid=true
  318. data-cycle-carousel-visible="'. absint( $options['logo_slider_visible_items'] ) .'"
  319. data-cycle-speed="'. esc_attr( $options['logo_slider_transition_length'] ) * 1000 .'"
  320. data-cycle-timeout="'. esc_attr( $options['logo_slider_transition_delay'] ) * 1000 .'"
  321. data-cycle-prev=".cycle-prev"
  322. data-cycle-next=".cycle-next"
  323. data-cycle-slides="> article"
  324. >';
  325.  
  326. if ( 'demo' == $slider_type ) {
  327. $output .= higher_education_demo_logo_slider();
  328. }
  329. elseif ( 'post' == $slider_type || 'page' == $slider_type || 'category' == $slider_type) {
  330. $output .= higher_education_post_page_category_logo_slider( $options );
  331. }
  332. else {
  333. $output .= higher_education_image_logo_slider( $options );
  334. }
  335.  
  336. $output .= '
  337. </div><!-- .logo_slider_content_slider_wrap.cycle-slideshow -->
  338. </div><!-- .wrapper -->
  339. </div><!-- #slider-section -->';
  340.  
  341. set_transient( 'higher_education_logo_slider', $output, 86940 );
  342. }
  343. echo $output;
  344. }
  345. }
  346. add_action( 'higher_education_after_content', 'higher_education_logo_slider', 80 );
  347.  
  348. function higher_education_courses_display_position() {
  349. // Getting data from Theme Options
  350. $options = higher_education_get_theme_options();
  351.  
  352. if ( $options['courses_position'] ) {
  353. add_action( 'higher_education_after_content', 'higher_education_courses_display', 90 );
  354. }
  355. else {
  356. add_action( 'higher_education_before_content', 'higher_education_courses_display', 70 );
  357. }
  358. }
  359.  
  360. function higher_education_our_professors_display_position() {
  361. // Getting data from Theme Options
  362. $options = higher_education_get_theme_options();
  363.  
  364. if ( $options['our_professors_position'] ) {
  365. add_action( 'higher_education_after_content', 'higher_education_our_professors_display', 100 );
  366. }
  367. else {
  368. add_action( 'higher_education_before_content', 'higher_education_our_professors_display', 80 );
  369. }
  370. }
  371.  
  372. function higher_education_testimonial_display_position() {
  373. // Getting data from Theme Options
  374. $options = higher_education_get_theme_options();
  375.  
  376. if ( $options['testimonial_position'] ) {
  377. add_action( 'higher_education_after_content', 'higher_education_testimonial_display', 110 );
  378. }
  379. else {
  380. add_action( 'higher_education_before_content', 'higher_education_testimonial_display', 90 );
  381. }
  382. }
  383.  
  384. function higher_education_events_display_position() {
  385. // Getting data from Theme Options
  386. $options = higher_education_get_theme_options();
  387.  
  388. if ( $options['events_position'] ) {
  389. add_action( 'higher_education_after_content', 'higher_education_events_display', 110 );
  390. }
  391. else {
  392. add_action( 'higher_education_before_content', 'higher_education_events_display', 100 );
  393. }
  394. }
  395.  
  396. function higher_education_news_display_position() {
  397. // Getting data from Theme Options
  398. $options = higher_education_get_theme_options();
  399.  
  400. if ( $options['news_position'] ) {
  401. add_action( 'higher_education_after_content', 'higher_education_news_display', 120 );
  402. }
  403. else {
  404. add_action( 'higher_education_before_content', 'higher_education_news_display', 110 );
  405. }
  406. }
  407.  
  408.  
  409.  
  410. function remove_parent_action() {
  411. remove_action( 'higher_education_after_header', 'higher_education_featured_overall_image', 60 );
  412. remove_action( 'higher_education_before_content', 'higher_education_hero_content_display', 20 );
  413. remove_action( 'higher_education_after_content', 'higher_education_featured_content_display', 40 );
  414. remove_action( 'higher_education_before_content', 'higher_education_promotion_headline_display', 40 );
  415. remove_action( 'higher_education_before_content', 'higher_education_portfolio_display', 50);
  416. remove_action( 'higher_education_before_content', 'higher_education_logo_slider', 60 );
  417. remove_action( 'higher_education_after_content', 'higher_education_courses_display', 50 );
  418. remove_action( 'higher_education_after_content', 'higher_education_our_professors_display', 60 );
  419. remove_action( 'higher_education_after_content', 'higher_education_testimonial_display', 70 );
  420. remove_action( 'higher_education_after_content', 'higher_education_events_display', 80 );
  421. remove_action( 'higher_education_after_content', 'higher_education_news_display', 90 );
  422. }
  423. add_action( 'init', 'remove_parent_action');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement