WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
Problems with custom post types introduced by a theme (16 posts)

  1. lucabarbetti
    Member
    Posted 1 year ago #

    Hi there,
    I have problems with some themes that introduce custom post types as homepage elements, like sliders, portfolios and features/homeboxes. Polylang recognizes the custom post types introduced by the themes and some of them are translatable and work correctly but others, even if I check the corresponding checkboxes in Polylang Settings page, are either not translatable or don't 'keep' the translations (the last translation overwrite the previous ones). I use WP 3.5.1 and Polylang 1.0.1 in a test localhost environment.
    The (free) themes are:
    - Sitecorp and Boldy by Site5: they both add three custom post types (CPT), Portfolio, Slider and Options Framework Internal Container, and one custom taxonomy (CT), Types. If I switch theme and then switch back only Portfolio stay checked while the others need to be checked.
    Portfolio is partially translatable, which means that title and content fields can be different as per language but the media (e.g. image) field is not. Slider is not translatable which means that the 'widget' that allows to selct language and add/edit corresponding translations doesn't show up, and none of its fields (title, caption, image link and image) can be translated. Options Framework Internal Container is not translatable but this is different from Slider because you can set values for this custom post type only through Theme Options->Homepage, it doesn't exist on the dashboard a tab (like Pages, Posts, etc.) that allows to add/edit/delete the posts.

    - Swatch by Woothemes: it adds five CPTs, WooFramework Internal Container, Mini-Features, Slides, Portfolio and Feedback, and one CT, Portfolio Galleries. If I switch theme all but the CT stay checked.
    Slides, Portfolio and Mini-features are partially translatable, title and content can be different as per language but all the other fields, that are in the Swatch Custom Settings pane, are not translatable. I haven't tried Feedbacks but I suspect that they have the same problem. One thing that i noticed is that on Slides and Portfolio lists there aren't flags and plus/pensil symbols on the right side of the windowpane, while Mini-features and Feedback lists have the flags and plus/pencil symbols on the right.

    - Panoramica by CPOThemes: it adds three CPTs, Slides, Features and Portfolio and one CT, Categories. This is the theme that works best with Polylang because all the CPTs and and almost all of their fields are translatable. Maybe I have not tried everything yet but so far only the images, that are set as featured images, aren't translatable (this would be important only if I'd need to show different images for different languages, which is not my case). All the CPTs lists show flags and plus/pensil symbols on the right side of the windowpane.

    Thanks a lot for your help!

    http://wordpress.org/extend/plugins/polylang/

  2. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Let's start with Swatch with which I made some tests.

    One thing that i noticed is that on Slides and Portfolio lists there aren't flags and plus/pensil symbols on the right side of the windowpane

    The theme badly overwrites all existing columns :(. As Polylang adds the languages columns before the theme does, they are erased. I made a modification so that the Polylang columns are added very late and it solves the issue. You can try the development version:
    http://downloads.wordpress.org/plugin/polylang.zip

    title and content can be different as per language but all the other fields, that are in the Swatch Custom Settings pane, are not translatable

    In fact I believe they are but since these fields are custom fields, they are messed by the synchronization process. You should uncheck the synchronization for custom fields in Polylang settings. You may have the same problem with the featured image.

    Let me know if there are still other issues.

  3. lucabarbetti
    Member
    Posted 1 year ago #

    I have just done few tests and... you are the man!!!
    The development version brought back all the flags and stuff in the dashboard, and disabling the sychronization for Custom Fields gave back the translations for all the fields of the Custom Post Types.
    I'll keep on testing but, hey, so far so good!
    Thanks a lot!!!
    :)

  4. lucabarbetti
    Member
    Posted 1 year ago #

    Hi Chouby,
    could you have a look at these two?
    1) Swatch introduces several widgets but only their Titles can be translated in Settings->Languages->String Translation, all the other texts and links can't be translated. Actually the same thing happens also with the Text widget of WordPress, therefore it might not be only related to the theme.
    2) Another problem with Swatch, and I think this might be a difficult one to fix, is that in Swatch->Theme Options->Homepage you can select a page to be shown on a column of the frontpage, unfortunately its content appears always in the same language. When you select this page, the dropdown menu shows all the translations of all the pages, there is no per language separation, and then Swatch and Polylang pick up the same selected page no matter what language has been chosen by the visitor.
    Thanks a lot!

  5. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    1. The easiest for widgets which need to be fully translated (as the text widget) is to add one widget per language and to display it only in that language.

    2. Could you try to copy / paste http://pastebin.com/utLLn1cu in a php file, upload it in your plugins directory and activate the newly created plugin?

  6. lucabarbetti
    Member
    Posted 1 year ago #

    Thanks my friend,
    1) makes me feel really dumb! How in the hell could I not think about it?
    2) I did what you said but what is it supposed to do?

  7. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    It was supposed to automatically find the translation of your page... This is something I am currently working on for a future version (probably 1.1).

    I just tested it and it seems to work. I set a page in the Swatch option, translated it in the other language and the correct page in the correct language is loaded whatever the language of the front page.

  8. lucabarbetti
    Member
    Posted 1 year ago #

    Got it, elegant solution indeed. It doesn't seem to work for me though, I've followed all the steps, the plugin is recognized by WP and activated but it doesn't switch the page. Don't know...
    Anyway, as a workaround in the particular case of Swatch, one could use the text widget instead of selecting a page because that area is 'widgetized', one widget per language as you explained before.

  9. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Iw onder why it works for me and not for you. Did you test with only Swatch, Polylang and this auto-translate plugin activated?

    Otherwise you should obtain the same result by modifying the file swatch/includes/home-pagecontent.php at line 16 and replace

    <?php query_posts( 'page_id=' . intval( $woo_options['woo_main_page'] ) ); ?>

    by

    <?php $id = intval( $woo_options['woo_main_page'] );
    if (function_exists('pll_get_post'))
      $id = pll_get_post($id);
    query_posts( 'page_id=' . $id ); ?>

    Of course it is best to make a child theme

  10. lucabarbetti
    Member
    Posted 1 year ago #

    Sorry, I couldn't try the mod and reply earlier.
    Changing home-pagecontent.php did the job.
    As for the auto-translate plugin, yes, it was a fresh WP 3.5.1 install with only Polylang and Swatch as the active theme. I've even recreated the plugin by copying and pasting the 'raw' code and by downloading the code, but to no avail. I know this is silly, but could you double check that we are using the same exact code? :)
    Anyway, thanks a lot... it always amazes me how you are capable of finding a solution to everything, one way or another.

  11. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    You are right, a bad copy paste, and I forgot the last line. I modified the code (together with some other bug corrections). If you want to test again (without the modifications of home-pagecontent.php)...

  12. lucabarbetti
    Member
    Posted 1 year ago #

    Well done, it works! :)
    Thanks a lot

  13. klimam
    Member
    Posted 9 months ago #

    Hi i am still having problems with Swatch slider and Mini-Features translation. I setup the translated pages but they don ´t apear on the homepage (still remain in the first language) How pls. did you set it?

  14. klimam
    Member
    Posted 9 months ago #

    Seems to be problem with the upgrade. Version 1.1.6. works perfect ( custom post type - slider - swatch theme), latest version does not work as should, development version neither..

  15. Chouby
    Member
    Plugin Author

    Posted 9 months ago #

    Maybe you should try with the (new) development version (1.2.3.4)

  16. klimam
    Member
    Posted 9 months ago #

    1.2.3.4 and the problem is solved :D thank you, respect!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic