Skip to content

Commit

Permalink
Merge pull request #1 from codestag/release-v1.0.1
Browse files Browse the repository at this point in the history
Release v1.0.1
  • Loading branch information
lushkant authored Aug 30, 2023
2 parents 848e0b0 + f571c71 commit caa3c4f
Show file tree
Hide file tree
Showing 9 changed files with 590 additions and 523 deletions.
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
### Higgs Assistant Changelog

## 1.0.1 - August 30, 2023
* Fix Testimonials widget
* Fix escaping and conditional checks
* Other minor improvements

## 1.0.0 - June 16, 2020
* Initial release
4 changes: 2 additions & 2 deletions higgs-assistant.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: A plugin to assist Higgs theme in adding widgets.
* Author: Codestag
* Author URI: https://codestag.com
* Version: 1.0
* Version: 1.0.1
* Text Domain: higgs-assistant
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
Expand Down Expand Up @@ -52,7 +52,7 @@ public static function register() {
* @since 1.0
*/
public function define_constants() {
$this->define( 'HA_VERSION', '1.0' );
$this->define( 'HA_VERSION', '1.0.1' );
$this->define( 'HA_DEBUG', true );
$this->define( 'HA_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
$this->define( 'HA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
Expand Down
195 changes: 104 additions & 91 deletions includes/widgets/portfolio.php
Original file line number Diff line number Diff line change
@@ -1,92 +1,100 @@
<?php
if ( ! class_exists( 'Higgs_Portfolio' ) ) :
/**
* Displays recent portfolio posts.
*
* @since 1.0.0.
* @package Higgs
*/
class Higgs_Portfolio extends Stag_Widget {
public function __construct() {
$this->widget_id = 'higgs_portfolio';
$this->widget_cssclass = 'section-portfolio';
$this->widget_description = __( 'Display recent portfolio post in grid style.', 'higgs-assistant' );
$this->widget_name = __( 'Section: Portfolio', 'higgs-assistant' );
$this->settings = array(
'title' => array(
'type' => 'text',
'std' => '',
'label' => __( 'Title:', 'higgs-assistant' ),
),
'orderby' => array(
'type' => 'select',
'std' => 'post_date',
'label' => __( 'Sort by:', 'higgs-assistant' ),
'options' => array(
'post_date' => __( 'Date', 'higgs-assistant' ),
'title' => __( 'Title', 'higgs-assistant' ),
'rand' => __( 'Random', 'higgs-assistant' ),
/**
* Displays recent portfolio posts.
*
* @since 1.0.0.
* @package Higgs
*/
class Higgs_Portfolio extends Stag_Widget {
public function __construct() {
$this->widget_id = 'higgs_portfolio';
$this->widget_cssclass = 'section-portfolio';
$this->widget_description = __( 'Display recent portfolio post in grid style.', 'higgs-assistant' );
$this->widget_name = __( 'Section: Portfolio', 'higgs-assistant' );
$this->settings = array(
'title' => array(
'type' => 'text',
'std' => '',
'label' => __( 'Title:', 'higgs-assistant' ),
),
),
'number' => array(
'type' => 'number',
'std' => '6',
'label' => __( 'Count:', 'higgs-assistant' ),
'step' => '1',
'min' => '1',
'max' => '20',
),
'more_text' => array(
'type' => 'text',
'std' => __( 'View all Posts', 'higgs-assistant' ),
'label' => __( 'More Posts text:', 'higgs-assistant' ),
),
);

parent::__construct();
}
'orderby' => array(
'type' => 'select',
'std' => 'post_date',
'label' => __( 'Sort by:', 'higgs-assistant' ),
'options' => array(
'post_date' => __( 'Date', 'higgs-assistant' ),
'title' => __( 'Title', 'higgs-assistant' ),
'rand' => __( 'Random', 'higgs-assistant' ),
),
),
'number' => array(
'type' => 'number',
'std' => '6',
'label' => __( 'Count:', 'higgs-assistant' ),
'step' => '1',
'min' => '1',
'max' => '20',
),
'more_text' => array(
'type' => 'text',
'std' => __( 'View all Posts', 'higgs-assistant' ),
'label' => __( 'More Posts text:', 'higgs-assistant' ),
),
);

parent::__construct();
}

function widget( $args, $instance ) {
if ( $this->get_cached_widget( $args ) )
return;
function widget( $args, $instance ) {
if ( $this->get_cached_widget( $args ) ) {
return;
}

ob_start();
ob_start();

extract( $args );
extract( $args );

$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
$orderby = $instance['orderby'];
$number = absint( $instance['number'] );
$more_text = strip_tags( $instance['more_text'] );
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
$orderby = $instance['orderby'];
$number = absint( $instance['number'] );
$more_text = wp_strip_all_tags( $instance['more_text'] );

echo $before_widget;
echo $before_widget;

$link = get_post_type_archive_link( 'jetpack-portfolio' );
$link = get_post_type_archive_link( 'jetpack-portfolio' );

if ( $title ) :
echo $before_title;
echo $title;
if ( '' != $link ) : ?>
if ( $title ) :
echo $before_title;
echo $title;
if ( '' !== $link ) : ?>
<span class="custom-link">
<a href="<?php echo esc_url( $link ); ?>"><?php echo esc_html( $more_text ); ?> <span class="genericon genericon-next"></span></a>
</span>
<?php endif;
echo $after_title;
endif;

add_filter( 'subtitle_view_supported', '__return_false' );

$p = new WP_Query( apply_filters( 'higgs_portfolio_args', array(
'post_type' => 'jetpack-portfolio',
'post_status' => 'publish',
'orderby' => $orderby,
'posts_per_page' => $number,
'no_found_rows' => true,
'ignore_sticky_posts' => true,
'meta_query' => array( array( 'key' => '_thumbnail_id' ) ),
) ) );

if ( $p->have_posts() ) : ?>
<?php
endif;
echo $after_title;
endif;

add_filter( 'subtitle_view_supported', '__return_false' );

$p = new WP_Query(
apply_filters(
'higgs_portfolio_args',
array(
'post_type' => 'jetpack-portfolio',
'post_status' => 'publish',
'orderby' => $orderby,
'posts_per_page' => $number,
'no_found_rows' => true,
'ignore_sticky_posts' => true,
'meta_query' => array( array( 'key' => '_thumbnail_id' ) ),
)
)
);

if ( $p->have_posts() ) :
?>

<div id="portfolio-container" class="portfolio-container">
<div class="portfolio-loader">
Expand All @@ -99,33 +107,38 @@ function widget( $args, $instance ) {
</div>
</div>

<?php while ( $p->have_posts() ) : $p->the_post();
get_template_part( 'partials/content', 'portfolio-archive' );
endwhile; ?>
<?php
while ( $p->have_posts() ) :
$p->the_post();
get_template_part( 'partials/content', 'portfolio-archive' );
endwhile;
?>

<div id="gutter-sizer"></div>
</div>
<?php endif;
<?php
endif;

remove_all_filters( 'subtitle_view_supported' );
remove_all_filters( 'subtitle_view_supported' );

wp_reset_postdata();
wp_reset_postdata();

?>
?>

<?php echo $after_widget;
<?php
echo $after_widget;

$content = ob_get_clean();
$content = ob_get_clean();

echo $content;
echo $content;

$this->cache_widget( $args, $content );
}
$this->cache_widget( $args, $content );
}

public static function register() {
register_widget( __CLASS__ );
public static function register() {
register_widget( __CLASS__ );
}
}
}
endif;

add_action( 'widgets_init', array( 'Higgs_Portfolio', 'register' ) );
Loading

0 comments on commit caa3c4f

Please sign in to comment.