Skip to content

Fixed filtering enqueue by post type - #38

Merged
jeremyzahner merged 2 commits into
getherbert:devfrom
giwrgos88:dev
Dec 16, 2016
Merged

Fixed filtering enqueue by post type#38
jeremyzahner merged 2 commits into
getherbert:devfrom
giwrgos88:dev

Conversation

@giwrgos88

Copy link
Copy Markdown
Contributor

Method was always returning true so filtering wasn't working

Method was always returning true so filtering wasn't working
Comment threadHerbert/Framework/Enqueue.php Outdated
public function filterPostType($attrs, $filterWith)
{
return array_search(get_post_type(), $filterWith) !== null;
return array_search(get_post_type(), $filterWith) !== FALSE ? TRUE : FALSE;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ternary operator is useless for booleans.

returnarray_search(get_post_type(), $filterWith) !== false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So please remove ? TRUE : FALSE since there is no point in having that.

@jeremyzahnerjeremyzahner self-assigned this Nov 16, 2016

@giwrgos88giwrgos88 left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed ternary operator

@jeremyzahner

Copy link
Copy Markdown
Contributor

@giwrgos88 Thanks!

@jeremyzahner
jeremyzahner merged commit 4c0be93 into getherbert:devDec 16, 2016
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@giwrgos88@jeremyzahner