Myzwer / foothillschurch

Bootcamp II is a wordpress theme (as well as an inside joke) designed to suit the needs of foothillschurch.com. It makes use of webpack, Babel, Sass, Tailwind, Browsersync, PostCSS, ESLint, Stylelint, Prettier and more. It is meant for that site, but if you can use it by all means go for it.
1 stars 1 forks source link

Reference current $post instead of array index #42

Closed rain2o closed 1 month ago

rain2o commented 1 month ago

https://github.com/Myzwer/foothillschurch/blob/effc5bbf81497ae99f0561ab7849412fe9272bfd/frontpage.php#L117

You can just use $post['ID'] here since you're in a loop. Looks like you use that above a few places, but this line uses the first index of the array of posts instead.

rain2o commented 1 month ago

Also in this file: https://github.com/Myzwer/foothillschurch/blob/effc5bbf81497ae99f0561ab7849412fe9272bfd/frontpage.php#L120-L127

I've seen this a few places around the code. These are unnecessary variable declarations. Not really problematic, but not needed. Some languages present issues if you create too many variables (memory issues etc...), so just something to keep in mind. Instead something like would work fine

display_taxonomy_terms( $post['ID'], 'speaker', 'Speaker' );
display_taxonomy_terms( $post['ID'], 'series', 'Series' );