Skip to content

Commit caa3c4f

Browse files
authored
Merge pull request #1 from codestag/release-v1.0.1
Release v1.0.1
2 parents 848e0b0 + f571c71 commit caa3c4f

9 files changed

+590
-523
lines changed

changelog.txt

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
### Higgs Assistant Changelog
22

3+
## 1.0.1 - August 30, 2023
4+
* Fix Testimonials widget
5+
* Fix escaping and conditional checks
6+
* Other minor improvements
7+
38
## 1.0.0 - June 16, 2020
49
* Initial release

higgs-assistant.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: A plugin to assist Higgs theme in adding widgets.
66
* Author: Codestag
77
* Author URI: https://codestag.com
8-
* Version: 1.0
8+
* Version: 1.0.1
99
* Text Domain: higgs-assistant
1010
* License: GPL2+
1111
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
@@ -52,7 +52,7 @@ public static function register() {
5252
* @since 1.0
5353
*/
5454
public function define_constants() {
55-
$this->define( 'HA_VERSION', '1.0' );
55+
$this->define( 'HA_VERSION', '1.0.1' );
5656
$this->define( 'HA_DEBUG', true );
5757
$this->define( 'HA_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
5858
$this->define( 'HA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );

includes/widgets/portfolio.php

+104-91
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,100 @@
11
<?php
22
if ( ! class_exists( 'Higgs_Portfolio' ) ) :
3-
/**
4-
* Displays recent portfolio posts.
5-
*
6-
* @since 1.0.0.
7-
* @package Higgs
8-
*/
9-
class Higgs_Portfolio extends Stag_Widget {
10-
public function __construct() {
11-
$this->widget_id = 'higgs_portfolio';
12-
$this->widget_cssclass = 'section-portfolio';
13-
$this->widget_description = __( 'Display recent portfolio post in grid style.', 'higgs-assistant' );
14-
$this->widget_name = __( 'Section: Portfolio', 'higgs-assistant' );
15-
$this->settings = array(
16-
'title' => array(
17-
'type' => 'text',
18-
'std' => '',
19-
'label' => __( 'Title:', 'higgs-assistant' ),
20-
),
21-
'orderby' => array(
22-
'type' => 'select',
23-
'std' => 'post_date',
24-
'label' => __( 'Sort by:', 'higgs-assistant' ),
25-
'options' => array(
26-
'post_date' => __( 'Date', 'higgs-assistant' ),
27-
'title' => __( 'Title', 'higgs-assistant' ),
28-
'rand' => __( 'Random', 'higgs-assistant' ),
3+
/**
4+
* Displays recent portfolio posts.
5+
*
6+
* @since 1.0.0.
7+
* @package Higgs
8+
*/
9+
class Higgs_Portfolio extends Stag_Widget {
10+
public function __construct() {
11+
$this->widget_id = 'higgs_portfolio';
12+
$this->widget_cssclass = 'section-portfolio';
13+
$this->widget_description = __( 'Display recent portfolio post in grid style.', 'higgs-assistant' );
14+
$this->widget_name = __( 'Section: Portfolio', 'higgs-assistant' );
15+
$this->settings = array(
16+
'title' => array(
17+
'type' => 'text',
18+
'std' => '',
19+
'label' => __( 'Title:', 'higgs-assistant' ),
2920
),
30-
),
31-
'number' => array(
32-
'type' => 'number',
33-
'std' => '6',
34-
'label' => __( 'Count:', 'higgs-assistant' ),
35-
'step' => '1',
36-
'min' => '1',
37-
'max' => '20',
38-
),
39-
'more_text' => array(
40-
'type' => 'text',
41-
'std' => __( 'View all Posts', 'higgs-assistant' ),
42-
'label' => __( 'More Posts text:', 'higgs-assistant' ),
43-
),
44-
);
45-
46-
parent::__construct();
47-
}
21+
'orderby' => array(
22+
'type' => 'select',
23+
'std' => 'post_date',
24+
'label' => __( 'Sort by:', 'higgs-assistant' ),
25+
'options' => array(
26+
'post_date' => __( 'Date', 'higgs-assistant' ),
27+
'title' => __( 'Title', 'higgs-assistant' ),
28+
'rand' => __( 'Random', 'higgs-assistant' ),
29+
),
30+
),
31+
'number' => array(
32+
'type' => 'number',
33+
'std' => '6',
34+
'label' => __( 'Count:', 'higgs-assistant' ),
35+
'step' => '1',
36+
'min' => '1',
37+
'max' => '20',
38+
),
39+
'more_text' => array(
40+
'type' => 'text',
41+
'std' => __( 'View all Posts', 'higgs-assistant' ),
42+
'label' => __( 'More Posts text:', 'higgs-assistant' ),
43+
),
44+
);
45+
46+
parent::__construct();
47+
}
4848

49-
function widget( $args, $instance ) {
50-
if ( $this->get_cached_widget( $args ) )
51-
return;
49+
function widget( $args, $instance ) {
50+
if ( $this->get_cached_widget( $args ) ) {
51+
return;
52+
}
5253

53-
ob_start();
54+
ob_start();
5455

55-
extract( $args );
56+
extract( $args );
5657

57-
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
58-
$orderby = $instance['orderby'];
59-
$number = absint( $instance['number'] );
60-
$more_text = strip_tags( $instance['more_text'] );
58+
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
59+
$orderby = $instance['orderby'];
60+
$number = absint( $instance['number'] );
61+
$more_text = wp_strip_all_tags( $instance['more_text'] );
6162

62-
echo $before_widget;
63+
echo $before_widget;
6364

64-
$link = get_post_type_archive_link( 'jetpack-portfolio' );
65+
$link = get_post_type_archive_link( 'jetpack-portfolio' );
6566

66-
if ( $title ) :
67-
echo $before_title;
68-
echo $title;
69-
if ( '' != $link ) : ?>
67+
if ( $title ) :
68+
echo $before_title;
69+
echo $title;
70+
if ( '' !== $link ) : ?>
7071
<span class="custom-link">
7172
<a href="<?php echo esc_url( $link ); ?>"><?php echo esc_html( $more_text ); ?> <span class="genericon genericon-next"></span></a>
7273
</span>
73-
<?php endif;
74-
echo $after_title;
75-
endif;
76-
77-
add_filter( 'subtitle_view_supported', '__return_false' );
78-
79-
$p = new WP_Query( apply_filters( 'higgs_portfolio_args', array(
80-
'post_type' => 'jetpack-portfolio',
81-
'post_status' => 'publish',
82-
'orderby' => $orderby,
83-
'posts_per_page' => $number,
84-
'no_found_rows' => true,
85-
'ignore_sticky_posts' => true,
86-
'meta_query' => array( array( 'key' => '_thumbnail_id' ) ),
87-
) ) );
88-
89-
if ( $p->have_posts() ) : ?>
74+
<?php
75+
endif;
76+
echo $after_title;
77+
endif;
78+
79+
add_filter( 'subtitle_view_supported', '__return_false' );
80+
81+
$p = new WP_Query(
82+
apply_filters(
83+
'higgs_portfolio_args',
84+
array(
85+
'post_type' => 'jetpack-portfolio',
86+
'post_status' => 'publish',
87+
'orderby' => $orderby,
88+
'posts_per_page' => $number,
89+
'no_found_rows' => true,
90+
'ignore_sticky_posts' => true,
91+
'meta_query' => array( array( 'key' => '_thumbnail_id' ) ),
92+
)
93+
)
94+
);
95+
96+
if ( $p->have_posts() ) :
97+
?>
9098

9199
<div id="portfolio-container" class="portfolio-container">
92100
<div class="portfolio-loader">
@@ -99,33 +107,38 @@ function widget( $args, $instance ) {
99107
</div>
100108
</div>
101109

102-
<?php while ( $p->have_posts() ) : $p->the_post();
103-
get_template_part( 'partials/content', 'portfolio-archive' );
104-
endwhile; ?>
110+
<?php
111+
while ( $p->have_posts() ) :
112+
$p->the_post();
113+
get_template_part( 'partials/content', 'portfolio-archive' );
114+
endwhile;
115+
?>
105116

106117
<div id="gutter-sizer"></div>
107118
</div>
108-
<?php endif;
119+
<?php
120+
endif;
109121

110-
remove_all_filters( 'subtitle_view_supported' );
122+
remove_all_filters( 'subtitle_view_supported' );
111123

112-
wp_reset_postdata();
124+
wp_reset_postdata();
113125

114-
?>
126+
?>
115127

116-
<?php echo $after_widget;
128+
<?php
129+
echo $after_widget;
117130

118-
$content = ob_get_clean();
131+
$content = ob_get_clean();
119132

120-
echo $content;
133+
echo $content;
121134

122-
$this->cache_widget( $args, $content );
123-
}
135+
$this->cache_widget( $args, $content );
136+
}
124137

125-
public static function register() {
126-
register_widget( __CLASS__ );
138+
public static function register() {
139+
register_widget( __CLASS__ );
140+
}
127141
}
128-
}
129142
endif;
130143

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

0 commit comments

Comments
 (0)