コード例 #1
0
    /**
     * Render main shortcode.
     * 
     * @since 1.0.0
     * @access public
     * @param array $atts 
     * @param string $content 
     * @return string
     */
    public function render_shortcode($atts, $content = null)
    {
        extract(shortcode_atts(array('layout' => 'solid', 'thinkness' => '', 'divider_color' => ''), $atts, $this->shortcode));
        ob_start();
        ?>

		<div class="tf_divider <?php 
        echo $layout;
        ?>
" style="border-top-width: <?php 
        echo empty($thinkness) ? 1 : $thinkness;
        ?>
px;
			<?php 
        if ('' != $divider_color) {
            ?>
border-top-color: <?php 
            echo tf_get_rgba_color($divider_color);
            ?>
;<?php 
        }
        ?>
		"></div>

		<?php 
        $output = ob_get_clean();
        return $output;
    }
コード例 #2
0
 /**
  * Render main shortcode.
  * 
  * @since 1.0.0
  * @access public
  * @param array $atts 
  * @param string $content 
  * @return string
  */
 public function render_shortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('size' => 'normal', 'style' => 'circle', 'icons' => 0), array_filter($atts)));
     // Begin building markup for icon.
     $output = '';
     if ($icons > 0 && !empty($atts['icons_order'])) {
         $output .= sprintf('<ul class="tf_icons %s %s">', $size, $style);
         $ids = explode(',', $atts['icons_order']);
         foreach ($ids as $id) {
             foreach (array('icon', 'icon_color', 'icon_bg', 'label', 'link') as $prop) {
                 $name = "icons_{$id}_{$prop}";
                 ${$prop} = isset($atts[$name]) ? $atts[$name] : '';
             }
             $output .= '<li class="tf_icon">';
             // Set front and background colors.
             $colors = '';
             $style_attr = '';
             if (!empty($icon_bg)) {
                 $colors .= 'background-color: ' . tf_get_rgba_color($icon_bg) . ';';
             }
             if (!empty($icon_color)) {
                 $colors .= 'color: ' . tf_get_rgba_color($icon_color) . ';';
             }
             if (!empty($colors)) {
                 $style_attr = 'style="' . esc_attr($colors) . '"';
             }
             // Sanitize link
             $output .= '<a href="' . esc_url($link) . '" class="tf_icon_link">';
             // Build icon
             if (!empty($icon)) {
                 $output .= '<i class="tf_icon_icon fa ' . esc_attr($icon) . '" ' . $style_attr . '></i>';
             }
             // Build label
             if (!empty($label)) {
                 $output .= '<span class="tf_icon_label">' . $label . '</span>';
             }
             $output .= '</a>';
             $output .= '</li>';
         }
         $output .= '</ul>';
     }
     return $output;
 }