function mpcth_icon_divider_shortcode($atts, $content = null) { extract(shortcode_atts(array('title' => '', 'icon' => '', 'color' => '', 'color_active' => '', 'background' => '', 'background_active' => '', 'button_text' => '', 'button_url' => '', 'subheading' => '', 'css_animation' => ''), $atts)); $css_id = 'mpcth_sc_icon_divider_' . mpcth_random_ID(5); $return = '<div id="' . $css_id . '" class="mpcth-sc-icon-divider mpcth-waypoint-trigger' . add_css_animation($css_animation) . '">'; $return .= '<div class="mpcth-sc-icon-divider-line"></div>'; if ($button_url != '') { $return .= '<small class="mpcth-sc-icon-divider-button"><a class="mpcth-sc-icon-divider-button-link" href="' . $button_url . '">' . $button_text . '</a></small>'; } $return .= '<div class="mpcth-sc-icon-divider-wrap">'; $return .= '<div class="mpcth-sc-icon-divider-icon mpcth-sc-icon mpcth-sc-icon-' . $icon . '"></div>'; $return .= '<p class="mpcth-sc-icon-divider-title">' . $title . '</p>'; $return .= '</div>'; if ($subheading != '') { $return .= '<h5 class="mpcth-sc-icon-divider-subheading">' . $subheading . '</h5>'; } $return .= '</div>'; $return .= '<style>'; $return .= '#' . $css_id . '.mpcth-sc-icon-divider .mpcth-sc-icon-divider-line { background: ' . $background . '; }' . PHP_EOL; $return .= '#' . $css_id . '.mpcth-sc-icon-divider .mpcth-sc-icon-divider-icon { color: ' . $color . '; }' . PHP_EOL; $return .= '#' . $css_id . '.mpcth-sc-icon-divider .mpcth-sc-icon-divider-title { color: ' . $color . '; }' . PHP_EOL; $return .= '#' . $css_id . '.mpcth-sc-icon-divider .mpcth-sc-icon-divider-wrap { background: ' . $background . '; border-bottom-color: ' . mpcth_adjust_brightness($background, -20) . ' !important; }' . PHP_EOL; $return .= '#' . $css_id . '.mpcth-sc-icon-divider.mpcth-waypoint-triggered .mpcth-sc-icon-divider-icon { color: ' . $color_active . '; }' . PHP_EOL; $return .= '#' . $css_id . '.mpcth-sc-icon-divider.mpcth-waypoint-triggered .mpcth-sc-icon-divider-title { color: ' . $color_active . '; }' . PHP_EOL; $return .= '#' . $css_id . '.mpcth-sc-icon-divider.mpcth-waypoint-triggered .mpcth-sc-icon-divider-wrap { background: ' . $background_active . '; border-bottom-color: ' . mpcth_adjust_brightness($background_active, -20) . ' !important; }' . PHP_EOL; $return .= '</style>'; $return = parse_shortcode_content($return); return $return; }
function widget($args, $instance) { extract($args); global $shortname; global $mpcth_options; $title = $instance['title']; $id = $instance['id']; $number = absint($instance['number']); // Number of Tweets $unique = mpcth_random_ID(10); $tweets = get_transient('mpcth_twitter_' . $id . '_' . $number); $is_cached = $tweets !== false; echo $before_widget; ?> <h5 class="widget_title"><?php echo $title; ?> </h5> <ul id="mpcth_twitter_<?php echo $unique; ?> " class="mpcth-twitter-wrap<?php echo $is_cached ? ' mpcth-twitter-cached' : ''; ?> " data-number="<?php echo $number; ?> " data-id="<?php echo $id; ?> " data-unique="<?php echo $unique; ?> "> <?php if ($is_cached) { echo urldecode($tweets); } ?> </ul> <?php echo $after_widget; }