WordPress.org

Ready to get started?Download WordPress

Forums

Contextual Related Posts
Contextual Related Posts and WPML (9 posts)

  1. tdebaillon
    Member
    Posted 1 year ago #

    Hi all,
    I use WPML to maintain a bilingual blog, and the CRP plugin usually shows the corresponding post in the other language.
    Is there a way to filter out the results to avoid this, maybe by using some add_filter() function in my theme?
    Thanks a lot if you can help.

    http://wordpress.org/extend/plugins/contextual-related-posts/

  2. Ajay
    Member
    Plugin Author

    Posted 1 year ago #

    I'm not sure how exactly WPML works. But, it would be something along the lines of

    If main language then display posts else don't.

    You'll need to use the manual install option from the FAQ

  3. tdebaillon
    Member
    Posted 1 year ago #

    I assigned different categories for different languages, so, for some other plugins, I test the language and display the right category accordingly:

    if (ICL_LANGUAGE_CODE == 'en') {
    		$my_filter_cat = '4';
    	} else {
    		$my_filter_cat = '5';
    	}

    Is a similar construct (passing a category argument to some function) possible with CRP?

  4. Ajay
    Member
    Plugin Author

    Posted 1 year ago #

    Yes,

    It might be something along the lines of:

    if ((ICL_LANGUAGE_CODE == 'en')&&(function_exists('echo_ald_crp'))) echo_ald_crp();

    Add this just after the_content() of your theme

  5. tdebaillon
    Member
    Posted 1 year ago #

    OK,
    If I understand well, I have to directly call ald_crp to be able to filter the result conditionally?
    Except that get_crp takes its arguments from the database, not at runtime, and there is no apply-filter hook available.
    I am afraid I am stuck.

  6. Ajay
    Member
    Plugin Author

    Posted 1 year ago #

    Not sure what you mean by

    Except that get_crp takes its arguments from the database, not at runtime, and there is no apply-filter hook available.

    Are you trying to pass some parameters to CRP based on the language?

  7. tdebaillon
    Member
    Posted 1 year ago #

    Yes, my aim is not to display the plugin with certain language only. What I'd like to do is restricting the category to display based on the language used.

    This would require directly passing a category ID (or a range of) to CRP, and filter its output from code, not from initial settings.

  8. Ajay
    Member
    Plugin Author

    Posted 1 year ago #

    I think that is clear to me. The bad news is you can't do that right now since CRP doesn't support restricting to a category yet.

    It's one of the main to-dos in the next version of the plugin. I've yet to get some free time to work on the plugin.

  9. tdebaillon
    Member
    Posted 1 year ago #

    Too bad...
    Anyway thanks for this great plugin!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.