示例#1
0
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        // Output before widget
        echo $args['before_widget'];
        // Title for Widget
        $title = "";
        if (!empty($instance['title'])) {
            $title = $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
            echo trim($title);
        }
        // Custom values for widget
        $imgurl = empty($instance['imgurl']) ? ' ' : apply_filters('widget_title', $instance['imgurl']);
        $imgalt = empty($instance['imgalt']) ? ' ' : apply_filters('widget_title', $instance['imgalt']);
        $linkurl = empty($instance['linkurl']) ? ' ' : apply_filters('widget_title', $instance['linkurl']);
        if (!empty($imgurl)) {
            ?>

			<?php 
            if ($linkurl) {
                ?>
			<a href="<?php 
                echo $linkurl;
                ?>
">
			<?php 
            }
            ?>

				<?php 
            if ($linkurl) {
                ?>
				<?php 
                inti_do_srcset_image($imgurl, $imgalt);
                ?>
				<?php 
            }
            ?>

			<?php 
            if ($linkurl) {
                ?>
			</a>
			<?php 
            }
        } else {
            ?>

			<div class="callout alert">
				<p><?php 
            e_('No image added to this image widget', 'inti');
            ?>
</p>
			</div>

		<?php 
        }
        // Output after widget
        echo $args['after_widget'];
    }
				<?php 
inti_hook_site_banner_site_logo_before();
?>
				<?php 
if (get_inti_option('logo_image', 'inti_customizer_options')) {
    ?>
				<div class="site-logo">
					<a href="<?php 
    echo esc_url(home_url('/'));
    ?>
" title="<?php 
    echo esc_attr(get_bloginfo('name', 'display'));
    ?>
" rel="home">
						<?php 
    inti_do_srcset_image(get_inti_option('logo_image', 'inti_customizer_options'), esc_attr(get_bloginfo('name', 'display') . ' logo'));
    ?>
					</a>
				</div><!-- .site-logo -->
				<?php 
    inti_hook_site_banner_site_logo_after();
    ?>
				<?php 
    inti_hook_site_banner_title_area_before();
    ?>
				<?php 
}
// end of logo
?>
				<div class="title-area">
					<h1 class="site-title"><a href="<?php 
/**
 * Add main menu before or after site banner
 * add or remove .row to control max width
 * 
 * @since 1.0.4
 */
function child_do_main_dropdown_menu()
{
    //adds the main menu
    if (has_nav_menu('dropdown-menu')) {
        ?>
		<nav class="top-bar" id="top-bar-menu">
			<div class="row">

			<?php 
        /**
         * Add logo or site title to the navigation bar, in addition or instead of having the site banner
         */
        $mobilebanner = get_inti_option('show_nav_logo_title', 'inti_customizer_options', 'none');
        if ($mobilebanner != 'none') {
            ?>
				<div class="top-bar-left float-left hide-for-mlarge mobile-banner">
					<ul class="menu">
						<li class="menu-text site-logo">
							<?php 
            if (get_inti_option('nav_logo_image', 'inti_customizer_options')) {
                ?>
								<?php 
                inti_do_srcset_image(get_inti_option('nav_logo_image', 'inti_customizer_options'), esc_attr(get_bloginfo('name', 'display') . ' logo'));
                ?>
							<?php 
            }
            ?>
						</li>
						<li class="menu-text site-title"><?php 
            bloginfo('name');
            ?>
</li>
					</ul>
				</div>
			<?php 
        }
        ?>
				<div class="top-bar-left show-for-mlarge main-dropdown-menu">
					<?php 
        echo inti_get_dropdown_menu();
        ?>
				</div>
				<div class="top-bar-right show-for-mlarge">
					<?php 
        $showsocial = get_inti_option('nav_social', 'inti_headernav_options');
        if ($showsocial) {
            echo inti_get_dropdown_social_links();
        }
        ?>
				</div>
				<div class="top-bar-right float-right hide-for-mlarge">
					<ul class="menu">
						<li class="menu-text off-canvas-button"><a data-toggle="inti-off-canvas-menu">
							<div class="hamburger">
								<span></span>
								<span></span>
								<span></span>
							</div>
						</a></li>
					</ul>
				</div>
			</div>
		</nav>
	<?php 
    }
}