Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #4

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions plugin.php
Expand Up @@ -20,18 +20,18 @@
// ------------------------------------------------------------------------------
// Prevent direct file access
// ------------------------------------------------------------------------------
if (!defined('WPINC')) :
if (!defined('WPINC')) {
die;
endif;
}

// ------------------------------------------------------------------------------
// Autoloader
// ------------------------------------------------------------------------------
$autoloader = dirname(__FILE__).'/vendor/autoload.php';

if (is_readable($autoloader)) :
if (is_readable($autoloader)) {
require_once $autoloader;
endif;
}

// ------------------------------------------------------------------------------
// Bootstrap
Expand Down
6 changes: 2 additions & 4 deletions src/Blocks/ClientsBlock.php
Expand Up @@ -46,11 +46,9 @@ public function render($attributes)
'showposts' => $attributes['postsToShow'],
]);

if ($query->have_posts()) :

if ($query->have_posts()) {
require apply_filters('custom-post-type-clients-loop-template', plugin_dir_path(__FILE__).'/../../views/loop.php', $query, $attributes);

endif;
}

return ob_get_clean();
}
Expand Down
6 changes: 3 additions & 3 deletions src/Clients.php
Expand Up @@ -33,7 +33,7 @@ public function register()
*
* @author Ralf Hortt <me@horttcore.de>
*/
public function getConfig() : array
public function getConfig(): array
{
return [
'public' => true,
Expand Down Expand Up @@ -67,7 +67,7 @@ public function getConfig() : array
*
* @return array
**/
public function getLabels() : array
public function getLabels(): array
{
return [
'name' => _x('Clients', 'post type general name', 'custom-post-type-clients'),
Expand Down Expand Up @@ -107,7 +107,7 @@ public function getLabels() : array
*
* @return array Update messages
**/
public function getPostUpdateMessages(\WP_Post $post, string $postType, \WP_Post_Type $postTypeObjects) : array
public function getPostUpdateMessages(\WP_Post $post, string $postType, \WP_Post_Type $postTypeObjects): array
{
$messages = [
0 => '', // Unused. Messages start at index 1.
Expand Down
4 changes: 2 additions & 2 deletions views/loop.php
Expand Up @@ -6,10 +6,10 @@
} ?>
<div class="clients__list">
<?php
while ($query->have_posts()) :
while ($query->have_posts()) {
$query->the_post();
require apply_filters('custom-post-type-clients-single-template', plugin_dir_path(__FILE__).'single.php', $query, $attributes);
endwhile;
}
?>
</div>
</section>
22 changes: 11 additions & 11 deletions views/single.php
@@ -1,20 +1,20 @@
<?php
$link = get_post_meta(get_the_ID(), '_url', true);

if ($link) :
if ($link) {
?><a <?php post_class('clients__client client__link') ?> href="<?php echo esc_url_raw($link) ?>"><?php
else :
?><div <?php post_class('clients__client') ?>><?php
endif;
} else {
?><div <?php post_class('clients__client') ?>><?php
}

if (has_post_thumbnail()) :
if (has_post_thumbnail()) {
the_post_thumbnail(apply_filters('custom-post-type-clients-image-size', 'full'), ['class' => 'client__image', 'data-no-lazy' => '1']);
else :
} else {
the_title();
endif;
}

if ($link) :
if ($link) {
?></a><?php
else :
?></div><?php
endif;
} else {
?></div><?php
}