Esempio n. 1
0
        function form($instance)
        {
            /* Impostazioni di default del widget */
            $defaults = array('title' => 'Featured Projects', 'icon' => 'comment', 'project_n_items' => 5, 'project_fx' => 'slide', 'project_timeout_fx' => 8000, 'project_speed_fx' => 300, 'project_post_type' => 'portfolio');
            $config = YIT_Config::load();
            $yit_easings = $config['easings'];
            $yit_cycle_fxs = $config['cycle_fx'];
            $instance = wp_parse_args((array) $instance, $defaults);
            ?>
        <p>
            <label for="<?php 
            echo $this->get_field_id('title');
            ?>
">Title:
                 <input type="text" id="<?php 
            echo $this->get_field_id('title');
            ?>
" name="<?php 
            echo $this->get_field_name('title');
            ?>
" value="<?php 
            echo $instance['title'];
            ?>
" class="widefat" />
            </label>
        </p>

        <p>

            <label for="<?php 
            echo $this->get_field_id('project_post_type');
            ?>
">Portfolio:

                 <select id="<?php 
            echo $this->get_field_id('project_post_type');
            ?>
" name="<?php 
            echo $this->get_field_name('project_post_type');
            ?>
">
					 <?php 
            $portfolios = yit_portfolios();
            ?>
					 <?php 
            foreach ($portfolios as $portfolio) {
                ?>
					 	 <option value="<?php 
                echo $portfolio->ID;
                ?>
"<?php 
                if ($portfolio->ID == $instance['project_post_type']) {
                    ?>
 selected="selected"<?php 
                }
                ?>
><?php 
                echo $portfolio->post_title ? $portfolio->post_title : 'Portfolio ID: ' . $portfolio->ID;
                ?>
</option>
					 <?php 
            }
            ?>
                 </select>

            </label>

        </p>                            

        <p>
            <label for="<?php 
            echo $this->get_field_id('project_n_items');
            ?>
">Items:
                 <select id="<?php 
            echo $this->get_field_id('project_n_items');
            ?>
" name="<?php 
            echo $this->get_field_name('project_n_items');
            ?>
">
                    <?php 
            for ($i = 1; $i <= 20; $i++) {
                $select = '';
                if ($instance['project_n_items'] == $i) {
                    $select = ' selected="selected"';
                }
                echo "<option value=\"{$i}\"{$select}>{$i}</option>\n";
            }
            ?>
                 </select>
            </label>
        </p>

        

        <p>
            <label for="<?php 
            echo $this->get_field_id('project_fx');
            ?>
">Effect Slider:
                 <select id="<?php 
            echo $this->get_field_id('project_fx');
            ?>
" name="<?php 
            echo $this->get_field_name('project_fx');
            ?>
">
                    <?php 
            foreach (array('slide', 'fade') as $fx) {
                $select = '';
                if ($instance['project_fx'] == $fx) {
                    $select = ' selected="selected"';
                }
                echo "<option value=\"{$fx}\"{$select}>{$fx}</option>\n";
            }
            ?>
                 </select>
            </label>
        </p>          

        
        <p>
            <label for="<?php 
            echo $this->get_field_id('project_timeout_fx');
            ?>
">Timeout (ms):
                 <input type="text" id="<?php 
            echo $this->get_field_id('project_timeout_fx');
            ?>
" name="<?php 
            echo $this->get_field_name('project_timeout_fx');
            ?>
" value="<?php 
            echo $instance['project_timeout_fx'];
            ?>
" size="4" />
            </label>
        </p>          


        <p>
            <label for="<?php 
            echo $this->get_field_id('project_speed_fx');
            ?>
">Speed Animation (ms):
                 <input type="text" id="<?php 
            echo $this->get_field_id('project_speed_fx');
            ?>
" name="<?php 
            echo $this->get_field_name('project_speed_fx');
            ?>
" value="<?php 
            echo $instance['project_speed_fx'];
            ?>
" size="4" />
            </label>
        </p>
    <?php 
        }
Esempio n. 2
0
        function form($instance)
        {
            global $icons_name, $fxs, $easings;
            /* Impostazioni di default del widget */
            $defaults = array('title' => 'Featured Projects', 'project_n_items' => 4, 'project_speed_fx' => 200, 'project_post_type' => '');
            $instance = wp_parse_args((array) $instance, $defaults);
            ?>

        <p>
            <label for="<?php 
            echo $this->get_field_id('title');
            ?>
">Title:
                 <input type="text" id="<?php 
            echo $this->get_field_id('title');
            ?>
" name="<?php 
            echo $this->get_field_name('title');
            ?>
" value="<?php 
            echo $instance['title'];
            ?>
" class="widefat" />
            </label>
        </p> 
        
        <p>

            <label for="<?php 
            echo $this->get_field_id('project_post_type');
            ?>
">Portfolio:

                 <select id="<?php 
            echo $this->get_field_id('project_post_type');
            ?>
" name="<?php 
            echo $this->get_field_name('project_post_type');
            ?>
">
					 <?php 
            $portfolios = yit_portfolios();
            ?>
					 <?php 
            foreach ($portfolios as $portfolio) {
                ?>
					 	 <option value="<?php 
                echo $portfolio->ID;
                ?>
"<?php 
                if ($portfolio->ID == $instance['project_post_type']) {
                    ?>
 selected="selected"<?php 
                }
                ?>
><?php 
                echo $portfolio->post_title ? $portfolio->post_title : 'Portfolio ID: ' . $portfolio->ID;
                ?>
</option>
					 <?php 
            }
            ?>
                 </select>

            </label>

        </p>       

        <p><?php 
            _e('Show a list of portfolio categories, for portfolio custom types.', 'yit');
            ?>
</p>             

        <p>
            <label for="<?php 
            echo $this->get_field_id('project_n_items');
            ?>
">Items:
                 <select id="<?php 
            echo $this->get_field_id('project_n_items');
            ?>
" name="<?php 
            echo $this->get_field_name('project_n_items');
            ?>
">
                    <?php 
            for ($i = 1; $i <= 20; $i++) {
                $select = '';
                if ($instance['project_n_items'] == $i) {
                    $select = ' selected="selected"';
                }
                echo "<option value=\"{$i}\"{$select}>{$i}</option>\n";
            }
            ?>
                 </select>
            </label>
        </p>

        <p>
            <label for="<?php 
            echo $this->get_field_id('project_speed_fx');
            ?>
">Speed Animation (ms):
                 <input type="text" id="<?php 
            echo $this->get_field_id('project_speed_fx');
            ?>
" name="<?php 
            echo $this->get_field_name('project_speed_fx');
            ?>
" value="<?php 
            echo $instance['project_speed_fx'];
            ?>
" size="4" />
            </label>
        </p>
    <?php 
        }
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $project_post_types = isset($instance['project_post_type']) ? $instance['project_post_type'] : 0;
        echo $before_widget;
        echo $before_title . $title . $after_title;
        $portfolios = yit_portfolios();
        if ($project_post_types) {
            $i = 0;
            foreach ($portfolios as $portfolio) {
                if ($portfolio->ID == $project_post_types) {
                    ?>
	        		
	        		
	        		
				<ul id="gallery_categories_widget" class="<?php 
                    if (1 && yit_portfolio_get_setting('filter_active', $portfolio->ID)) {
                        ?>
 gallery-categories-quicksand<?php 
                    } else {
                        ?>
 gallery-categories-disabled<?php 
                    }
                    ?>
">
					<?php 
                    $cats = yit_portfolio_get_setting('categories', $portfolio->ID);
                    ?>
					<li class="segment-1"><a data-value="all" href="<?php 
                    echo get_post_permalink($portfolio->ID);
                    ?>
"><?php 
                    _e('All', 'yit');
                    ?>
</a></li>
	        		<?php 
                    if (isset($cats) && $cats != '') {
                        ?>
						<?php 
                        foreach ($cats as $cat => $name) {
                            ?>
				         	<?php 
                            if (yit_work_items_in_category($cat, $portfolio->ID)) {
                                ?>
				           		<li class="segment-<?php 
                                echo ++$i;
                                ?>
"><a href="<?php 
                                echo add_query_arg('cat', $cat, get_post_permalink($portfolio->ID));
                                ?>
" data-value="<?php 
                                echo strtolower(preg_replace('/\\s+/', '-', $cat));
                                ?>
"><?php 
                                echo $name;
                                ?>
</a></li>
							<?php 
                            }
                            ?>
						<?php 
                        }
                        ?>
					<?php 
                    }
                    ?>
				</ul>
				<?php 
                    break;
                }
            }
        }
        echo $after_widget;
    }
Esempio n. 4
0
 function widget($args, $instance)
 {
     $yit_portfolio = yit_portfolios();
     extract($args);
     $project_n_items = isset($instance['items']) ? $instance['items'] : 6;
     $project_post_types = isset($instance['project_post_type']) ? $instance['project_post_type'] : false;
     /* User-selected settings. */
     $title = apply_filters('widget_title', $instance['title']);
     global $more;
     $more = 0;
     if ($project_post_types) {
         foreach ($yit_portfolio as $portfolio) {
             if ($portfolio->ID == $project_post_types) {
                 echo $before_widget;
                 if ($title) {
                     echo $before_title . $title . $after_title;
                 }
                 $portfolios = yit_portfolio_get_setting('items', $portfolio->ID);
                 echo '<div class="portfolio-gallery-widget group">';
                 echo '<ul>';
                 //loop
                 yit_set_portfolio_loop($portfolio->ID);
                 $i = 0;
                 foreach ($portfolios as $item_id => $item) {
                     $post_permalink = yit_work_permalink($item_id);
                     echo '<li class="work-item group">';
                     echo '<a class="work-thumb" href="' . $post_permalink . '">';
                     yit_image("id={$item_id}&size=portfolio_gallery_thumb");
                     echo '</a>';
                     echo '</li>';
                     if (++$i == $project_n_items) {
                         break;
                     }
                 }
                 echo '</ul>';
                 echo '</div>';
                 echo $after_widget;
                 break;
             }
         }
     }
 }