Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Child theme functions
- *
- * When using a child theme (see http://codex.wordpress.org/Theme_Development
- * and http://codex.wordpress.org/Child_Themes), you can override certain
- * functions (those wrapped in a function_exists() call) by defining them first
- * in your child theme's functions.php file. The child theme's functions.php
- * file is included before the parent theme's file, so the child theme
- * functions would be used.
- *
- * Text Domain: wpex
- * @link http://codex.wordpress.org/Plugin_API
- *
- */
- /**
- * Load the parent style.css file
- */
- function total_child_enqueue_parent_theme_style() {
- wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
- }
- add_action( 'wp_enqueue_scripts', 'total_child_enqueue_parent_theme_style' );
- include(WP_CONTENT_DIR . '/shortcodes.php');
- add_shortcode( 'test', 'playlists' );
- add_image_size( 'video-thumbs', 250, 150, true );
- // This is your function, you can name it anything you want
- function my_custom_header_text() {
- global $post;
- if ($post->post_type != 'portfolio') return;
- $content .= '<div class="video-content">';
- // $content .= (mm_access_decision(array("access"=>"true")) == true) ? get_field('protected_content') : get_field('preview_content');
- if (mm_access_decision(array("access"=>"true")) == true && is_singular('portfolio')) {
- $content .= get_field('protected_content');
- } else {
- $content .= get_field('preview_content');
- }
- /*
- if (get_field('preview_content') == '' && get_field('protected_content') == '' && is_singular('portfolio')) {
- $content .= '<div class="feature-img">' . the_post_thumbnail('full') . '</div>';
- }
- */
- if (mm_access_decision(array("access"=>"true")) == true && get_field('preview_content') == '' && get_field('protected_content') && is_singular('portfolio')) {
- $content .= '<div class="feature-img">' . the_post_thumbnail('full') . '</div>';
- } else if (mm_access_decision(array("access"=>"false")) == true && get_field('preview_content') == '' && is_singular('portfolio')) {
- $content .= '<div class="feature-img">' . the_post_thumbnail('full') . '</div>';
- }
- $content .= '<div class="info-bar">';
- if (mm_access_decision(array("access"=>"false")) == true) {
- $content .='<div class="price">' . (get_field('price')!='' ? '<span>Price: $</span>' . get_field('price') : '') . '</div>';
- } elseif (mm_access_decision(array("access"=>"true")) == true && (is_singular('portfolio')) && (get_field('free') !='')) {
- $content .= '<div class="access">Free</div>';
- } elseif (is_singular('portfolio')) {
- $content .= '<div class="access">You have access to this video</div>';
- }
- if (mm_access_decision(array("access"=>"false")) == true && (get_field('product_id') !='')) {
- $productid = get_field('product_id');
- $bundleid = get_field('bundle_id');
- $content .= '<div class="buy-wrap"> <p> Buy: </p>';
- $content .= '<div class="button buy"><a href="' . mm_purchase_link(array("productId"=> $productid )) . '">Purchase just this video</a></div>';
- }
- if (mm_access_decision(array("access"=>"false")) == true && (get_field('bundle_id') !='')) {
- $content .= '<div class="button buy bundle"><a href="' . mm_purchase_link(array("productId"=> $bundleid )) . '">Purchase Bundle</a></div>';
- } elseif
- (get_field('bundle_url')) {
- $content .= '<div class="button buy bundle"><a href="' . get_field('bundle_url') . '">Purchase Bundle</a></div>';
- }
- $content .= '</div>'; #buy end
- $content .= '</div>'; /* info-bar-- */
- $content .= '</div>';
- if (mm_access_decision(array("access"=>"false")) == true) {
- $content .= '<p>Or buy an <a href="/join">All Access pass</a> and gain access to every video on the site</p>';
- }
- echo $content;
- }
- add_action( 'wpex_hook_content_before', 'my_custom_header_text', 999 );
- function customContentProtection($data)
- {
- return true;
- }
- add_filter('mm_bypass_content_protection', 'customContentProtection');
- function play_button($atts, $content) {
- extract(shortcode_atts(array(
- 'link' => "#",
- 'class' => "",
- 'playlist' => "",
- ), $atts));
- return '<a class="' . $class . '" href="' . $link . '" onclick="wistiaPlaylist.play(0,'.$playlist.');return true;">' . do_shortcode($content) . '</a>';
- }
- add_shortcode('playbutton', 'play_button');
- function alert_text($atts, $content) {
- return '<p class="alert">' . do_shortcode($content) . '</p>';
- }
- add_shortcode('alert', 'alert_text');
- function coupon($atts, $content) {
- $cc_code = '[MM_Form_Field name="couponCode"]';
- $cc_button = '[MM_Form_Button type="applyCoupon"]';
- $coupon .= 'Coupon:' . do_shortcode($cc_code);
- $coupon .= '<a href="' . do_shortcode($cc_button) . '">Apply Coupon</a>';
- return $content;
- }
- add_shortcode('coupon', 'coupon');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement