OpenPublicMedia/npr-cds-wordpress

Skipping promo cards

Closed this issue · 2 comments

Would you be open to a setting to skip promo cards in the layout? (If the station I'm working with agrees, I'd be happy to do a PR.)

Sure, fire away

I finally had a little time to take a run at this with #12.

I added a new npr_cds_add_asset_to_body filter to allow filtering the result of any asset before adding it to the body, since I've already had questions about modifying how some other assets are presented and it feels like this filter not only addresses promos but allows other modifications (including site-specific ones) pretty easily without needing a feature in the plugin for each one.

I'm open to different approaches. In particular, I'm not sure about passing my new npr_cds_add_asset_to_body a whole array of things to be added to $returnary is the most elegant. My reasoning was to keep the asset's rendered body content and any boolean flags together, since separating them feels like a recipe for them getting out of sync.

I'm also not sure if I added the filter for the new npr_cds_skip_promo_cards setting in the best place - I put it in the NPR_CDS class (in get_stories.php).