/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : ''); $advert_image = isset($instance['advert_image']) ? $instance['advert_image'] : ''; $advert_link = isset($instance['advert_link']) ? $instance['advert_link'] : ''; $advert_code = isset($instance['advert_code']) ? $instance['advert_code'] : ''; /* Before widget (defined by themes). */ echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <div class="widget_advert_inner"> <?php if ($advert_image != '') { echo ($advert_link != '' ? '<a href="' . $advert_link . '" class="image_wrapper">' : '') . '<img src="' . $advert_image . '" border="0" alt="' . $title . '" />' . ($advert_link != '' ? '</a>' : ''); } if ($advert_code != '') { if (get_custom_option('substitute_gallery') == 'yes') { $advert_code = substituteGallery($advert_code, 0, 275, 200); } $advert_code = do_shortcode($advert_code); if (get_custom_option('substitute_video') == 'yes') { $advert_code = substituteVideo($advert_code, 275, 200); } if (get_custom_option('substitute_audio') == 'yes') { $advert_code = substituteAudio($advert_code); } echo $advert_code; } ?> </div> <?php /* After widget (defined by themes). */ echo $after_widget; }
function themerex_widget_text_filter($text) { if (get_custom_option('substitute_gallery') == 'yes') { $text = substituteGallery($text, 0, 275, 200); } $text = do_shortcode($text); if (get_custom_option('substitute_video') == 'yes') { $text = substituteVideo($text, 275, 200); } if (get_custom_option('substitute_audio') == 'yes') { $text = substituteAudio($text); } return $text; }
} ?> <div class="itemscope" itemscope itemtype="http://schema.org/<?php echo $avg_author > 0 || $avg_users > 0 ? 'Review' : 'Article'; ?> "> <article <?php post_class('theme_article post_format_' . $post_format); ?> > <?php $post_title = apply_filters('the_title', getPostTitle()); $post_content = get_the_content(null, get_custom_option('show_text_before_readmore') != 'yes'); // Substitute WP [gallery] shortcode if (get_custom_option('substitute_gallery') == 'yes') { $post_content = substituteGallery($post_content, $post_id, $thumb_size[$blog_style]['w'], $thumb_size[$blog_style]['h'], 'none', true); } // Catch output from the_content filters $post_content = apply_filters('the_content', $post_content); // Substitute <video> tags to <iframe> if (get_custom_option('substitute_video') == 'yes') { $post_content = substituteVideo($post_content, $thumb_size[$blog_style]['w'], $thumb_size[$blog_style]['h']); } // Substitute <audio> tags with src from soundcloud to <iframe> if (get_custom_option('substitute_audio') == 'yes') { $post_content = substituteAudio($post_content); } $post_descr = apply_filters('the_excerpt', getPostDescription()); //get_the_excerpt(); // Get all post's categories $post_categories = getCategoriesByPostId($post_id);
function substituteAll($text, $w = 275, $h = 200) { if (get_custom_option('substitute_gallery') == 'yes') { $text = substituteGallery($text, 0, $w, $h); } $text = do_shortcode(apply_filters('themerex_sc_clear_around', $text)); if (get_custom_option('substitute_video') == 'yes') { $text = substituteVideo($text, $w, $h); } if (get_custom_option('substitute_audio') == 'yes') { $text = substituteAudio($text); } return $text; }