@ 2014-10-23T12:08:16Z <?php
/* Work Block */
if(!class_exists('ST_Portfolio_Block')) {
class ST_Portfolio_Block extends AQ_Block {
function __construct() {
$block_options = array(
'name' => '<i class="fa fa-archive"></i> Portfolio',
'size' => 'col-md-12',
);
//create the widget
parent::__construct('st_portfolio_block', $block_options);
}
function form($instance){
$defaults = array(
'title' => 'Title Portfolio',
'show' => '4',
'orderby' => 'title',
'orderpost' => 'ASC'
);
$instance = wp_parse_args($instance, $defaults);
extract($instance);
$orderpost_options = array (
'ASC' => 'ASC : lowest to highest',
'DESC' => 'DESC : highest to lowest',
);
$orderby_options = array (
'title' => 'Title',
'date' => 'Date',
'rand' => 'Random'
);
?>
<h3 style="text-align: center;">Portfolio</h3>
<div class="description">
<label for="<?php echo $this->get_field_id('title') ?>">
Title<br/><em style="font-size: 0.8em;">(Please enter title portfolio)</em><br/>
<?php echo aq_field_input('title', $block_id, $title, $size = 'full') ?>
</label>
</div>
<div class="cf"></div>
<div class="description third">
<label for="<?php echo $this->get_field_id('show') ?>">
Show portfolio<br/><em style="font-size: 0.8em;">(Chosen number portfolio. Ex: 6)</em><br/>
<?php echo aq_field_input('show', $block_id, $show, $size = 'full',$type = 'number') ?>
</label>
</div>
<div class="description third">
<label for="<?php echo $this->get_field_id('orderpost') ?>">
Sort Order<br/><em style="font-size: 0.8em;">Sort from lowest to highest (Default)</em><br/>
<?php echo aq_field_select('orderpost', $block_id, $orderpost_options, $orderpost, $size = 'full') ?>
</label>
</div>
<div class="description third last">
<label for="<?php echo $this->get_field_id('orderby') ?>">
Order by<br/><em style="font-size: 0.8em;">Title (Default)</em><br/>
<?php echo aq_field_select('orderby', $block_id, $orderby_options, $orderby, $size = 'full') ?>
</label>
</div>
<div class="cf"></div>
<?php
}
function block($instance){
extract($instance);
$title1 = (!empty($title) ? ' '.esc_attr($title) : '');
$desc1 = (!empty($subtitle) ? ' '.esc_attr($subtitle) : '');
$show1 = (!empty($show) ? ' '.esc_attr($show) : '');
$text1 = (!empty($text) ? ' '.esc_attr($text) : '');
?>
<!-- Container -->
<div class="container">
<!-- Headline -->
<div class="fiveteen columns">
<div class="container">
<h3 class="headline"><?php echo htmlspecialchars_decode($title1); ?></h3>
<span class="line" style="margin-bottom:35px;"></span>
</div>
<ul class="grid cs-style">
<?php
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => $show1,
'order' => $orderpost,
'orderby' => $orderby,
);
$wp_query = new WP_Query($args);
$i = 1;
while ($wp_query -> have_posts()) : $wp_query -> the_post();
$cates = get_the_terms(get_the_ID(),'categories');
$cate_name ='';
$cate_slug = '';
foreach((array)$cates as $cate){
if(count($cates)>0){
$cate_name .= $cate->name.' ' ;
$cate_slug .= $cate->slug .' ';
}
}
?>
<li>
<figure>
<?php $params = array( 'width' => 573, 'height' => 394 );
$image = bfi_thumb( wp_get_attachment_url(get_post_thumbnail_id()), $params ); ?>
<img src="<?php echo $image; ?>" alt="<?php the_title(); ?>"/>
<figcaption>
<h3><?php the_title();?></h3>
<span><?php echo $cate_name;?></span>
<a href="<?php the_permalink(); ?>"><?php global $theme_option; echo $theme_option['portfolio_read']; ?></a>
</figcaption>
</figure>
</li>
<?php $i++;
endwhile;?>
</ul>
<div class="clearfix"></div>
</div>
</div>
<!-- Container / End -->
<?
}
function update($new_instance, $old_instance) {
$new_instance = aq_recursive_sanitize($new_instance);
return $new_instance;
}
}
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.12 , 8.0.14 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Parse error: Unclosed '{' on line 66 in /in/0NWJf on line 131
Process exited with code 255 . Output for 8.0.13 Fatal error: Uncaught Error: Class "AQ_Block" not found in /in/0NWJf:4
Stack trace:
#0 {main}
thrown in /in/0NWJf on line 4
Process exited with code 255 . Output for 7.3.32 - 7.3.33 , 7.4.33 Fatal error: Uncaught Error: Class 'AQ_Block' not found in /in/0NWJf:4
Stack trace:
#0 {main}
thrown in /in/0NWJf on line 4
Process exited with code 255 . Output for 5.4.0 - 5.4.32 , 7.1.26 - 7.1.33 , 7.2.17 - 7.2.33 , 7.3.0 - 7.3.31 , 7.4.0 - 7.4.32 Parse error: syntax error, unexpected end of file in /in/0NWJf on line 131
Process exited with code 255 . Output for 5.4.34 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.7 - 5.6.21 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.20 , 7.2.0 - 7.2.11 Fatal error: Class 'AQ_Block' not found in /in/0NWJf on line 4
Process exited with code 255 . Output for 4.4.2 - 4.4.9 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 Parse error: syntax error, unexpected $end in /in/0NWJf on line 131
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 , 5.0.0 - 5.0.5 Parse error: parse error, unexpected $ in /in/0NWJf on line 131
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error in /in/0NWJf on line 131
Process exited with code 255 . preferences:dark mode live preview
179.83 ms | 401 KiB | 343 Q