コード例 #1
0
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : __('Our Work', 'optimizer');
        $subtitle = isset($instance['subtitle']) ? $instance['subtitle'] : __('Check Out Our Portfolio', 'optimizer');
        $layout = isset($instance['layout']) ? absint($instance['layout']) : '1';
        $type = isset($instance['type']) ? $instance['type'] : 'post';
        $count = isset($instance['count']) ? absint($instance['count']) : '6';
        $category = isset($instance['category']) ? $instance['category'] : '';
        $divider = isset($instance['divider']) ? apply_filters('widget_title', $instance['divider']) : 'fa-stop';
        $navigation = isset($instance['navigation']) ? $instance['navigation'] : 'numbered';
        $postbgcolor = isset($instance['postbgcolor']) ? $instance['postbgcolor'] : '';
        $titlecolor = isset($instance['titlecolor']) ? $instance['titlecolor'] : '';
        $secbgcolor = isset($instance['secbgcolor']) ? $instance['secbgcolor'] : '';
        /* Before widget (defined by themes). */
        echo $before_widget;
        if (is_customize_preview()) {
            echo '<span class="widgetname">' . $this->name . '</span>';
        }
        //THE QUERY
        if (!empty($category) && $type == 'post') {
            $blogcat = $category;
            $blogcats = implode(',', $blogcat);
        } else {
            $blogcats = '';
        }
        echo '<div class="postlayout_' . $layout . '">
		<div class="lay' . $layout . ' optimposts" data-post-layout="' . $layout . '" data-post-type="' . $type . '" data-post-count="' . $count . '" data-post-category="' . $blogcats . '" data-post-navigation="' . $navigation . '">
		<div class="center">';
        echo '<div class="homeposts_title">';
        if ($title) {
            echo '<h2 class="home_title">' . do_shortcode($title) . '</h2>';
        }
        if ($subtitle) {
            echo '<div class="home_subtitle">' . do_shortcode($subtitle) . '</div>';
        }
        if ($divider) {
            if ($divider !== 'no_divider') {
                echo '<div class="optimizer_divider"><span class="div_left"></span><span class="div_middle"><i class="fa ' . $divider . '"></i></span><span class="div_right"></span></div>';
            }
        }
        echo '</div>';
        //Call the Posts
        optimizer_posts($layout, $type, $count, $category, $navigation);
        echo '</div></div></div>';
        /* After widget (defined by themes). */
        echo $after_widget;
    }
コード例 #2
0
ファイル: index.php プロジェクト: pbhanu1994/bhanuprakash
                        	<?php 
                                get_template_part('template_parts/post', 'woo');
                                ?>

					<?php 
                            } else {
                                ?>

                    		<?php 
                                if ($type !== 'post') {
                                    $optimizer['posts_cat_id'] = '';
                                }
                                ?>

                    		<?php 
                                optimizer_posts($layout, $type, $count, $category, $navigation);
                                ?>

                    <?php 
                            }
                            ?>

                    
            
                       </div><!--center class end-->
                    </div><!--lay1 class end-->
                </div>
                <?php 
                        }
                        ?>