Skip to content

Commit

Permalink
Merge pull request #13 from Horttcore/analysis-KZJapQ
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
Horttcore authored Sep 8, 2020
2 parents ac4891e + 1666b7e commit fc967c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
11 changes: 6 additions & 5 deletions classes/custom-post-type-staff.admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ public function manage_staff_posts_custom_column($column, $post_id)

$meta = get_post_meta($post_id, '_staff-meta', true);

switch ($column) :
switch ($column) {

case 'thumbnail':
if (!has_post_thumbnail($post_id)) :
echo '<img src="http://www.gravatar.com/avatar/'.md5($meta['email']).'?d=mm" />'; else :
if (!has_post_thumbnail($post_id)) {
echo '<img src="http://www.gravatar.com/avatar/'.md5($meta['email']).'?d=mm" />';
} else {
echo get_the_post_thumbnail($post_id, 'thumbnail');
endif;
}
break;

case 'phone':
Expand All @@ -119,7 +120,7 @@ public function manage_staff_posts_custom_column($column, $post_id)
default:
break;

endswitch;
}
}

// END manage_staff_posts_custom_column
Expand Down
6 changes: 2 additions & 4 deletions classes/custom-post-type-staff.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,9 @@ public function render($attributes)
]);
}

if ($query->have_posts()) :

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

endif;
}

return ob_get_clean();
}
Expand Down
4 changes: 2 additions & 2 deletions views/loop.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<section class="staff">
<div class="posts posts--staff">
<?php
while ($query->have_posts()) :
while ($query->have_posts()) {
$query->the_post();
require apply_filters('custom-post-type-staff-single-template', plugin_dir_path(__FILE__).'single.php', $query, $attributes);
endwhile;
}
?>
</div>
</section>
12 changes: 6 additions & 6 deletions views/single.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<aside <?php post_class() ?>>

<?php if (has_post_thumbnail()) : ?>
<?php if (has_post_thumbnail()) { ?>
<figure class="staff__image">
<?php the_post_thumbnail(apply_filters('custom-post-type-staff-image-size', 'thumbnail'), ['class' => 'staff__image__img']); ?>
</figure>
<?php endif ?>
<?php } ?>

<div class="staff__wrapper">

Expand All @@ -14,16 +14,16 @@
</header>

<div class="staff__content">
<?php if (has_staff_meta('phone')) : ?>
<?php if (has_staff_meta('phone')) { ?>
<a href="<?php the_staff_meta('phone', 'tel:')?>">
<?php the_staff_meta('phone', '<div class="staff__phone">', '</div>') ?>
</a>
<?php endif ?>
<?php if (has_staff_meta('role')) : ?>
<?php } ?>
<?php if (has_staff_meta('role')) { ?>
<a href="<?php the_staff_meta('email', 'mailto:')?>">
<?php the_staff_meta('email', '<div class="staff__email">', '</div>') ?>
</a>
<?php endif ?>
<?php } ?>
</div>

</div>
Expand Down

0 comments on commit fc967c9

Please sign in to comment.