1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| <?php
if(!class_exists('AQ_Portfolio_Block')) {
class AQ_Portfolio_Block extends AQ_Block {
//set and create block
function __construct() {
$block_options = array(
'name' => 'Sort Portfolio',
'size' => 'span12',
'icon' => 'fa-th-large',
'icon_color' => 'FFF',
'category' => 'Content',
'help' => 'This is the block that adds sort portfolio block. This is the block where you can sort the portfolio items by category.',
'resizable' => 0
);
//create the block
parent::__construct('aq_portfolio_block', $block_options);
}
function form($instance) {
$port_categories_default = ($temp = get_terms('portfoliocategory')) ? $temp : array();
$categories_options_default = array();
$i = 0;
foreach($port_categories_default as $cat_default) {
$categories_options_default[$i++] = $cat_default->term_id;
}
$defaults = array(
'filter' => 1,
'categories_port' => $categories_options_default,
'numberofpost' => 12,
'id' => 'porfolio_block',
'port_ajax' => 'false',
'categories_port_selected' => '',
'fullwidth' => 1,
);
$instance = wp_parse_args($instance, $defaults);
extract($instance);
$port_categories = ($temp = get_terms('portfoliocategory')) ? $temp : array();
$categories_options = array();
foreach($port_categories as $cat) {
$categories_options[$cat->term_id] = $cat->name;
}
$port_categories = ($temp = get_terms('port')' |
Partager