Beispiel #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(wp_parse_args($atts, array('logo_type' => 'text', 'title_tag' => 'p', 'logo_text' => '', 'logo_image' => '', 'width' => '', 'height' => '', 'logo_link' => '')));
        if ('' == $logo_text) {
            $logo_text = get_bloginfo('name');
        }
        if ('' == $logo_link) {
            $logo_link = home_url();
        }
        ob_start();
        ?>

		<?php 
        if ($logo_type == 'text') {
            ?>
			<<?php 
            echo $title_tag;
            ?>
 class="tf_site_logo">
				<a href="<?php 
            echo $logo_link;
            ?>
"><?php 
            echo $logo_text;
            ?>
</a>
			</<?php 
            echo $title_tag;
            ?>
><!-- .tf_site_logo -->
		<?php 
        } else {
            ?>
			<figure class="tf_site_logo">
				<a href="<?php 
            echo $logo_link;
            ?>
"><img src="<?php 
            echo TF_Model::get_attachment_url($logo_image);
            ?>
" width="<?php 
            echo $width;
            ?>
" height="<?php 
            echo $height;
            ?>
" alt="<?php 
            echo $logo_text;
            ?>
" /></a>
			</figure>
		<?php 
        }
        ?>

		<?php 
        $output = ob_get_clean();
        return $output;
    }
Beispiel #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('layout' => 'image-top', 'image_url' => '', 'image_appearance' => '', 'title' => '', 'link' => '', 'alt' => '', 'caption' => '', 'width' => '', 'height' => '', 'image_color' => ''), $atts, $this->shortcode));
        $image = !empty($image_url) ? sprintf('<img src="%s" width="%s" height="%s" alt="%s" />', esc_attr(TF_Model::get_attachment_url($image_url)), esc_attr($width), esc_attr($height), esc_attr($alt)) : '';
        ob_start();
        ?>

		<div class="tf_image_wrapper <?php 
        echo $layout;
        ?>
 <?php 
        echo str_replace(',', ' ', $image_appearance);
        ?>
">

		<div class="tf_image_wrap">
			<?php 
        if (!empty($link)) {
            ?>
			<a href="<?php 
            echo esc_url($link);
            ?>
">
				<?php 
            echo wp_kses_post($image);
            ?>
			</a>
			<?php 
        } else {
            ?>
				<?php 
            echo wp_kses_post($image);
            ?>
			<?php 
        }
        ?>
		
		<?php 
        if ('image-overlay' != $layout) {
            ?>
		</div><!-- .tf_image_wrap -->
		<?php 
        }
        ?>
		
		<?php 
        if (!empty($title) || !empty($caption)) {
            ?>
		<div class="tf_image_content">
			<?php 
            if (!empty($title)) {
                ?>
			<h3 class="tf_image_title">
				<?php 
                if (!empty($link)) {
                    ?>
				<a href="<?php 
                    echo esc_url($link);
                    ?>
">
					<?php 
                    echo wp_kses_post($title);
                    ?>
				</a>
				<?php 
                } else {
                    ?>
					<?php 
                    echo wp_kses_post($title);
                    ?>
				<?php 
                }
                ?>
			</h3>
			<?php 
            }
            ?>
			
			<?php 
            if (!empty($caption)) {
                ?>
			<div class="tf_image_caption">
				<?php 
                echo apply_filters('tf_module_content', $caption);
                ?>
			</div><!-- .tf_image_caption -->
			<?php 
            }
            ?>
		</div><!-- .tf_image_content -->
		<?php 
        }
        ?>

		<?php 
        if ('image-overlay' == $layout) {
            ?>
		</div><!-- .tf_image_wrap -->
		<?php 
        }
        ?>

		</div>

		<?php 
        $output = ob_get_clean();
        return $output;
    }