Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.27 KB | None | 0 0
  1. <?php
  2. /**
  3. * Child theme functions
  4. *
  5. * When using a child theme (see http://codex.wordpress.org/Theme_Development
  6. * and http://codex.wordpress.org/Child_Themes), you can override certain
  7. * functions (those wrapped in a function_exists() call) by defining them first
  8. * in your child theme's functions.php file. The child theme's functions.php
  9. * file is included before the parent theme's file, so the child theme
  10. * functions would be used.
  11. *
  12. * Text Domain: wpex
  13. * @link http://codex.wordpress.org/Plugin_API
  14. *
  15. */
  16.  
  17. /**
  18. * Load the parent style.css file
  19. */
  20. function total_child_enqueue_parent_theme_style() {
  21. wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
  22. }
  23. add_action( 'wp_enqueue_scripts', 'total_child_enqueue_parent_theme_style' );
  24.  
  25. include(WP_CONTENT_DIR . '/shortcodes.php');
  26.  
  27. add_shortcode( 'test', 'playlists' );
  28.  
  29.  
  30. add_image_size( 'video-thumbs', 250, 150, true );
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. // This is your function, you can name it anything you want
  38. function my_custom_header_text() {
  39.  
  40. global $post;
  41.  
  42.  
  43. if ($post->post_type != 'portfolio') return;
  44.  
  45.  
  46. $content .= '<div class="video-content">';
  47.  
  48. // $content .= (mm_access_decision(array("access"=>"true")) == true) ? get_field('protected_content') : get_field('preview_content');
  49.  
  50.  
  51. if (mm_access_decision(array("access"=>"true")) == true && is_singular('portfolio')) {
  52.  
  53. $content .= get_field('protected_content');
  54.  
  55. } else {
  56.  
  57. $content .= get_field('preview_content');
  58.  
  59. }
  60.  
  61.  
  62. /*
  63.  
  64. if (get_field('preview_content') == '' && get_field('protected_content') == '' && is_singular('portfolio')) {
  65.  
  66. $content .= '<div class="feature-img">' . the_post_thumbnail('full') . '</div>';
  67.  
  68.  
  69. }
  70.  
  71. */
  72.  
  73. if (mm_access_decision(array("access"=>"true")) == true && get_field('preview_content') == '' && get_field('protected_content') && is_singular('portfolio')) {
  74.  
  75. $content .= '<div class="feature-img">' . the_post_thumbnail('full') . '</div>';
  76.  
  77. } else if (mm_access_decision(array("access"=>"false")) == true && get_field('preview_content') == '' && is_singular('portfolio')) {
  78.  
  79. $content .= '<div class="feature-img">' . the_post_thumbnail('full') . '</div>';
  80.  
  81. }
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. $content .= '<div class="info-bar">';
  92.  
  93.  
  94.  
  95. if (mm_access_decision(array("access"=>"false")) == true) {
  96.  
  97. $content .='<div class="price">' . (get_field('price')!='' ? '<span>Price: $</span>' . get_field('price') : '') . '</div>';
  98.  
  99. } elseif (mm_access_decision(array("access"=>"true")) == true && (is_singular('portfolio')) && (get_field('free') !='')) {
  100.  
  101. $content .= '<div class="access">Free</div>';
  102.  
  103.  
  104. } elseif (is_singular('portfolio')) {
  105.  
  106. $content .= '<div class="access">You have access to this video</div>';
  107.  
  108.  
  109.  
  110. }
  111.  
  112.  
  113.  
  114. if (mm_access_decision(array("access"=>"false")) == true && (get_field('product_id') !='')) {
  115.  
  116.  
  117.  
  118.  
  119. $productid = get_field('product_id');
  120.  
  121. $bundleid = get_field('bundle_id');
  122.  
  123. $content .= '<div class="buy-wrap"> <p> Buy: </p>';
  124.  
  125.  
  126. $content .= '<div class="button buy"><a href="' . mm_purchase_link(array("productId"=> $productid )) . '">Purchase just this video</a></div>';
  127.  
  128.  
  129.  
  130. }
  131.  
  132. if (mm_access_decision(array("access"=>"false")) == true && (get_field('bundle_id') !='')) {
  133.  
  134.  
  135. $content .= '<div class="button buy bundle"><a href="' . mm_purchase_link(array("productId"=> $bundleid )) . '">Purchase Bundle</a></div>';
  136.  
  137. } elseif
  138.  
  139. (get_field('bundle_url')) {
  140.  
  141.  
  142. $content .= '<div class="button buy bundle"><a href="' . get_field('bundle_url') . '">Purchase Bundle</a></div>';
  143.  
  144.  
  145. }
  146.  
  147.  
  148.  
  149. $content .= '</div>'; #buy end
  150.  
  151.  
  152. $content .= '</div>'; /* info-bar-- */
  153.  
  154.  
  155. $content .= '</div>';
  156.  
  157.  
  158. if (mm_access_decision(array("access"=>"false")) == true) {
  159.  
  160.  
  161.  
  162. $content .= '<p>Or buy an <a href="/join">All Access pass</a> and gain access to every video on the site</p>';
  163.  
  164. }
  165.  
  166.  
  167.  
  168.  
  169. echo $content;
  170.  
  171.  
  172.  
  173.  
  174.  
  175. }
  176.  
  177.  
  178. add_action( 'wpex_hook_content_before', 'my_custom_header_text', 999 );
  179.  
  180.  
  181.  
  182.  
  183.  
  184. function customContentProtection($data)
  185. {
  186. return true;
  187. }
  188. add_filter('mm_bypass_content_protection', 'customContentProtection');
  189.  
  190.  
  191.  
  192.  
  193. function play_button($atts, $content) {
  194. extract(shortcode_atts(array(
  195. 'link' => "#",
  196. 'class' => "",
  197. 'playlist' => "",
  198. ), $atts));
  199. return '<a class="' . $class . '" href="' . $link . '" onclick="wistiaPlaylist.play(0,'.$playlist.');return true;">' . do_shortcode($content) . '</a>';
  200. }
  201.  
  202.  
  203. add_shortcode('playbutton', 'play_button');
  204.  
  205.  
  206. function alert_text($atts, $content) {
  207. return '<p class="alert">' . do_shortcode($content) . '</p>';
  208. }
  209.  
  210.  
  211. add_shortcode('alert', 'alert_text');
  212.  
  213.  
  214. function coupon($atts, $content) {
  215.  
  216. $cc_code = '[MM_Form_Field name="couponCode"]';
  217.  
  218. $cc_button = '[MM_Form_Button type="applyCoupon"]';
  219.  
  220. $coupon .= 'Coupon:' . do_shortcode($cc_code);
  221.  
  222.  
  223. $coupon .= '<a href="' . do_shortcode($cc_button) . '">Apply Coupon</a>';
  224.  
  225. return $content;
  226.  
  227. }
  228.  
  229.  
  230. add_shortcode('coupon', 'coupon');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement