10up / curator

Select specific posts from across multiple post types to combine together and control the ordering.
38 stars 7 forks source link

Allow filtering of the curated post id #23

Closed emzo closed 9 years ago

emzo commented 9 years ago

Allow filtering of the curated post id to make it easier for 3rd party plugins (multilingual plugins for example) to do their magic.

Example use case with WPML

add_filter( 'cur_curated_post_id', function ( $id ) {
        return icl_object_id( $id, 'post', true );
} );
AaronHolbrook commented 9 years ago

Hi @emeaguiar - I'm not following the use case of why you'd want this - can you walk me through it a bit more?

emzo commented 9 years ago

Many multilingual plugins for WordPress store translations of posts as separate entries in the database, and use either a custom table, taxonomy or post meta field to relate the translations to each other. I wanted to use this plugin on a multilingual site I built recently using WPML, and this seemed like the best way to retrieve the curated posts in the current language. icl_object_id is a WPML function that takes a post ID and returns the ID of the translation.

AaronHolbrook commented 9 years ago

@emeaguiar Thanks for your patience - just merged your PR.

Thanks!