Example #1
0
function compare_button_func($atts, $content)
{
    extract(shortcode_atts(array('text' => '', 'link' => '', 'target' => '', 'bg_color' => '', 'bg_color_hvr' => '', 'border_radius' => '', 'icon' => '', 'font_color' => '', 'font_color_hvr' => '', 'size' => 'normal', 'align' => '', 'btn_width' => 'normal', 'inline' => 'no', 'margin' => ''), $atts));
    $rnd = compare_random_string();
    $style_css = '
	<style>
		a.' . $rnd . ', a.' . $rnd . ':active, a.' . $rnd . ':visited, a.' . $rnd . ':focus{
			display: ' . ($btn_width == 'normal' ? 'inline-block' : 'block') . ';
			' . (!empty($bg_color) ? 'background-color: ' . $bg_color . ';' : '') . '
			' . (!empty($font_color) ? 'color: ' . $font_color . ';' : '') . '
			' . (!empty($border_radius) ? 'border-radius: ' . $border_radius : '') . '
		}
		a.' . $rnd . ':hover{
			display: ' . ($btn_width == 'normal' ? 'inline-block' : 'block') . ';
			' . (!empty($bg_color_hvr) ? 'background-color: ' . $bg_color_hvr . ';' : '') . '
			' . (!empty($font_color_hvr) ? 'color: ' . $font_color_hvr . ';' : '') . '
		}		
	</style>
	';
    return compare_shortcode_style($style_css) . '
	<div class="btn-wrap" style="margin: ' . esc_attr($margin) . '; text-align: ' . $align . '; ' . ($inline == 'yes' ? 'display: inline-block;' : '') . ' ' . ($inline == 'yes' && $align == 'right' ? 'float: right;' : '') . '">
		<a href="' . esc_url($link) . '" class="btn btn-default ' . $size . ' ' . $rnd . ' ' . ($link != '#' && $link[0] == '#' ? 'slideTo' : '') . '" target="' . esc_attr($target) . '">
			' . ($icon != 'No Icon' && $icon != '' ? '<i class="fa fa-' . $icon . ' ' . (empty($text) ? 'no-margin' : '') . '"></i>' : '') . '
			' . $text . '
		</a>
	</div>';
}
Example #2
0
function compare_alert_func($atts, $content)
{
    extract(shortcode_atts(array('text' => '', 'border_color' => '', 'bg_color' => '', 'font_color' => '', 'icon' => '', 'closeable' => 'no', 'close_icon_color' => '', 'close_icon_color_hvr' => ''), $atts));
    $rnd = compare_random_string();
    $style_css = '
		<style>
			.' . $rnd . '.alert .close{
				color: ' . $close_icon_color . ';
			}
			.' . $rnd . '.alert .close:hover{
				color: ' . $close_icon_color_hvr . ';
			}
		</style>
	';
    return compare_shortcode_style($style_css) . '
	<div class="alert ' . $rnd . ' alert-default ' . ($closeable == 'yes' ? 'alert-dismissible' : '') . '" role="alert" style=" color: ' . $font_color . '; border-color: ' . $border_color . '; background-color: ' . $bg_color . ';">
		' . (!empty($icon) && $icon !== 'No Icon' ? '<i class="fa fa-' . $icon . '"></i>' : '') . '
		' . $text . '
		' . ($closeable == 'yes' ? '<button type="button" class="close" data-dismiss="alert"> <span aria-hidden="true">×</span> <span class="sr-only">' . __('Close', 'compare') . '</span> </button>' : '') . '
	</div>';
}
Example #3
0
function compare_progressbar_func($atts, $content)
{
    extract(shortcode_atts(array('label' => '', 'value' => '', 'color' => '', 'bgcolor' => '', 'label_color' => '', 'height' => '', 'font_size' => '', 'icon' => '', 'border_radius' => '', 'style' => ''), $atts));
    $rnd = compare_random_string();
    $style_css = '
	<style>
		.' . $rnd . '{
			' . (!empty($label_color) ? 'color: ' . $label_color . ';' : '') . '
			' . (!empty($border_radius) ? 'border-radius: ' . $border_radius . ';' : '') . '
			' . (!empty($height) ? 'height: ' . $height . ';' : '') . '
			' . (!empty($bgcolor) ? 'background-color: ' . $bgcolor . ';' : '') . '
		}

		.' . $rnd . ' .progress-bar{
			' . (!empty($font_size) ? 'font-size: ' . $font_size . ';' : '') . '
			' . (!empty($height) ? 'line-height: ' . $height . ';' : '') . '
			' . (!empty($color) ? 'background-color: ' . $color . ';' : '') . '
		}

		.' . $rnd . ' .progress-bar-value{
			' . (!empty($color) ? 'background-color: ' . $color . ';' : '') . '
			' . (!empty($label_color) ? 'color: ' . $label_color . ';' : '') . '
		}

		.' . $rnd . ' .progress-bar-value:after{
			' . (!empty($color) ? 'border-color: ' . $color . ' transparent;' : '') . '
		}
	</style>
	';
    return compare_shortcode_style($style_css) . '
	<div class="progress ' . $rnd . '">
	  <div class="progress-bar ' . $style . '" style="width: ' . esc_attr($value) . '%" role="progressbar" aria-valuenow="' . $value . '" aria-valuemin="0" aria-valuemax="100">
	  		<div class="progress-bar-value">' . $value . '%</div>
	  		' . (!empty($icon) ? '<i class="fa fa-' . $icon . '"></i>' : '') . '' . $label . '
	  </div>
	</div>';
}
Example #4
0
    public function widget($args, $instance)
    {
        extract($args);
        $title = empty($instance['title']) ? '' : $instance['title'];
        $menu = empty($instance['menu']) ? '' : $instance['menu'];
        $columns = empty($instance['columns']) ? '' : $instance['columns'];
        $rnd = compare_random_string();
        $menu = wp_get_nav_menu_items($menu);
        echo $before_widget . $before_title . $title . $after_title . '<div class="white-block-content">';
        if (!empty($menu)) {
            $style = '<style>
			.list_' . $rnd . '{
				columns: ' . $columns . ';
				-moz-columns: ' . $columns . ';
				-webkit-columns: ' . $columns . ';
				-ms-columns: ' . $columns . ';
				-o-columns: ' . $columns . ';
			}
			</style>';
            echo compare_shortcode_style($style) . '<ul class="list-unstyled list_' . $rnd . '">';
            foreach ($menu as $menu_item) {
                ?>
				<li>
					<a href="<?php 
                echo esc_url($menu_item->url);
                ?>
">
						<?php 
                echo esc_html($menu_item->title);
                ?>
					</a>
				</li>
				<?php 
            }
            echo '</ul>';
        }
        echo '</div>' . $after_widget;
    }