Skip to content

Commit

Permalink
fix(term-directive): Fix warnings for @term (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
theMosaad authored Feb 18, 2021
1 parent 1ff32b1 commit 6cf5181
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Directives/WordPress.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,29 +306,29 @@
$expression = Util::parse($expression);

if (! empty($expression->get(2))) {
return "<?php if (collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->isNotEmpty()) : ?>" . // phpcs:ignore
"<a href=\"<?= get_term_link(collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->term_ID); ?>\">" . // phpcs:ignore
"<?= collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->name(); ?>" .
return "<?php if (get_the_terms({$expression->get(1)}, {$expression->get(0)})) : ?>" . // phpcs:ignore
"<a href=\"<?= get_term_link(collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->term_id); ?>\">" . // phpcs:ignore
"<?= collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->name; ?>" .
"</a>" .
"<?php endif; ?>";
}

if (! empty($expression->get(1))) {
if ($expression->get(1) === 'true') {
return "<?php if (collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->isNotEmpty()) : ?>" .
"<a href=\"<?= get_term_link(collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->shift()->term_ID); ?>\">" . // phpcs:ignore
"<?= collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->shift()->name(); ?>" .
return "<?php if (get_the_terms(get_the_ID(), {$expression->get(0)})) : ?>" .
"<a href=\"<?= get_term_link(collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->shift()->term_id); ?>\">" . // phpcs:ignore
"<?= collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->shift()->name; ?>" .
"</a>" .
"<?php endif; ?>";
}

return "<?php if (collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->isNotEmpty()) : ?>" . // phpcs:ignore
"<?= collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->name(); ?>" .
return "<?php if (get_the_terms({$expression->get(1)}, {$expression->get(0)})) : ?>" . // phpcs:ignore
"<?= collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->name; ?>" .
"<?php endif; ?>";
}

if (! empty($expression->get(0))) {
return "<?php if (collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->isNotEmpty()) : ?>" .
return "<?php if (get_the_terms(get_the_ID(), {$expression->get(0)})) : ?>" .
"<?= collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->shift()->name; ?>" .
"<?php endif; ?>";
}
Expand Down

0 comments on commit 6cf5181

Please sign in to comment.