@@ -198,7 +198,7 @@ public function action_frontend_init() {
198198	public  function  get_headline () {
199199		$ options  = $ this  ->get_options ();
200200
201- 		if  ( $ options ['show_headline ' ] ) {
201+ 		if  ( !  empty (  $ options ['show_headline ' ] )  ) {
202202			$ headline  = sprintf (
203203				/** This filter is already documented in modules/sharedaddy/sharing-service.php */ 
204204				apply_filters ( 'jetpack_sharing_headline_html ' , '<h3 class="jp-relatedposts-headline"><em>%s</em></h3> ' , esc_html ( $ options ['headline ' ] ), 'related-posts '  ),
@@ -931,7 +931,7 @@ public function get_for_post_id( $post_id, array $args ) {
931931		}
932932
933933		if  (
934- 			!  $ options ['enabled ' ]
934+ 			empty (  $ options ['enabled ' ] ) 
935935			|| 0  === (int ) $ post_id
936936			|| empty ( $ options ['size ' ] )
937937		) {
@@ -1305,15 +1305,15 @@ protected function action_frontend_init_ajax( array $excludes ) {
13051305
13061306		$ response  = array (
13071307			'version '          => self ::VERSION ,
1308- 			'show_thumbnails '  => (bool ) $ options ['show_thumbnails ' ],
1309- 			'show_date '        => (bool ) $ options ['show_date ' ],
1310- 			'show_context '     => (bool ) $ options ['show_context ' ],
1311- 			'layout '           => (string ) $ options ['layout ' ],
1312- 			'headline '         => (string ) $ options ['headline ' ],
1308+ 			'show_thumbnails '  => (bool ) (  $ options ['show_thumbnails ' ] ??  false  ) ,
1309+ 			'show_date '        => (bool ) (  $ options ['show_date ' ] ??  true  ) ,
1310+ 			'show_context '     => (bool ) (  $ options ['show_context ' ] ??  true  ) ,
1311+ 			'layout '           => (string ) (  $ options ['layout ' ] ??  ' grid '  ) ,
1312+ 			'headline '         => (string ) (  $ options ['headline ' ] ??  ''  ) ,
13131313			'items '            => array (),
13141314		);
13151315
1316- 		if  ( count ( $ related_posts  ) === $ options ['size ' ] ) {
1316+ 		if  ( !  empty (  $ options [ ' size ' ] ) &&  count ( $ related_posts  ) === $ options ['size ' ] ) {
13171317			$ response ['items ' ] = $ related_posts ;
13181318		}
13191319
0 commit comments