{"id":15293921,"url":"https://github.com/socheatsok78/corcel-wpml","last_synced_at":"2025-10-07T06:31:12.099Z","repository":{"id":57037314,"uuid":"95942665","full_name":"socheatsok78/corcel-wpml","owner":"socheatsok78","description":"Corcel Multilingual Plugin for WPML [The WordPress Multilingual Plugin]","archived":true,"fork":false,"pushed_at":"2019-04-12T03:25:42.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T20:50:22.305Z","etag":null,"topics":["corcel","laravel-framework","wpml"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/socheatsok78.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-01T04:46:27.000Z","updated_at":"2023-01-28T18:24:44.000Z","dependencies_parsed_at":"2022-08-23T21:00:19.699Z","dependency_job_id":null,"html_url":"https://github.com/socheatsok78/corcel-wpml","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socheatsok78%2Fcorcel-wpml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socheatsok78%2Fcorcel-wpml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socheatsok78%2Fcorcel-wpml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socheatsok78%2Fcorcel-wpml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/socheatsok78","download_url":"https://codeload.github.com/socheatsok78/corcel-wpml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235599833,"owners_count":19016190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["corcel","laravel-framework","wpml"],"created_at":"2024-09-30T16:53:42.576Z","updated_at":"2025-10-07T06:31:05.588Z","avatar_url":"https://github.com/socheatsok78.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Corcel WPML\n\n\u003e This package allows you to use Corcel WordPress plugin with The WordPress Multilingual Plugin that allow you to easily build multilingual sites and run them. It’s powerful enough for corporate sites, yet simple for blogs.\n\n[![Travis branch](https://img.shields.io/travis/socheatsok78/wpml/master.svg?style=flat-square)](https://travis-ci.org/socheatsok78/wpml)\n[![GitHub issues](https://img.shields.io/github/issues/socheatsok78/wpml.svg?style=flat-square)](https://github.com/socheatsok78/wpml/issues)\n\n## Installation\n\u003e This package is still in development\n\nTo install Corcel WPML, just run the following command:\n```sh\ncomposer require peakhmr/wpml\n```\n[![Packagist](https://img.shields.io/packagist/dt/peakhmr/wpml.svg?style=flat-square)](https://packagist.org/packages/peakhmr/wpml)\n[![GitHub release](https://img.shields.io/github/release/peakhmr/wpml.svg?style=flat-square)](https://github.com/peakhmr/wpml/releases)\n\n\n## Usage\n---\n\n### Posts\n\u003e Every time you see Post::method(), if you're using your own Post class (where you set the connection name), like App\\Post you should use App\\Post::method() and not Post::method(). All the examples are assuming you already know this difference.\n\n```php\n// All published posts\n$posts = Post::published()-\u003eget();\n$posts = Post::status('publish')-\u003eget();\n\n// A specific post\n$post = Post::find(31);\necho $post-\u003epost_title;\n\n// Filter by meta/custom field\n$posts = Post::published()-\u003ehasMeta('field')-\u003eget();\n$posts = Post::hasMeta('acf')-\u003eget();\n```\n\n### Pages\n\u003e Pages are like custom post types. You can use Post::type('page') or the Page class.\n\n```php\n// Find a page by slug\n$page = Page::slug('about')-\u003efirst(); // OR\n$page = Post::type('page')-\u003eslug('about')-\u003efirst();\necho $page-\u003epost_title;\n```\n\nFor documentation please visit [jgrossi/corcel](https://github.com/corcel/corcel#usage) for Corcel's usage and then come back here for how to use wpml plugin.\n\n### Translations\n\u003e By using the `$post` object, we can access to the translation created by WPML.\n\nInstead of using `Corcel\\Post`, we use `Wpml\\Post` to Override few variables. The plugin will look for `wp_posts.ID` in `icl_translations.element_id` and return a collection of `icl_translations.trid`.\n\n```php\n// Find a translation collection by post id or slug\n$post = Post::find(31)-\u003etranslation(); \\\\ OR\n$post = Post::slug('about')-\u003etranslation();\n\n\\\\ Result\nTranslationCollection {#1855 ▼\n  #changedKeys: []\n  #items: array:2 [▼\n    0 =\u003e Translation {\n      #original: array:6 [▼\n        \"translation_id\" =\u003e 38\n        \"element_type\" =\u003e \"post_page\"\n        \"element_id\" =\u003e 31\n        \"trid\" =\u003e 19\n        \"language_code\" =\u003e \"en\"\n        \"source_language_code\" =\u003e null\n      ]\n    }\n    1 =\u003e Translation {#1853 ▶}\n  ]\n}\n```\n\n### Translate Post or Page\nIf you want to get the translated post object, use `translate()` scope and passing the `icl_translations.language_code` as parameter. This will return `Corcel\\Post` object as expected.\n\n```php\n// Find a translation collection by post id or slug\n\n$lang = 'en'; \\\\ OR\n$lang = config('app.locale');\n\n$post = Post::slug('about')-\u003etranslate($lang);\n\n\\\\ Result\nPage {#1847 ▼\n  #postType: \"page\"\n  #original: array:23 [▼\n    \"ID\" =\u003e 6\n    \"post_author\" =\u003e 1\n    \"post_date\" =\u003e \"2017-06-12 04:49:06\"\n    \"post_date_gmt\" =\u003e \"2017-06-12 04:49:06\"\n    \"post_content\" =\u003e \"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod.\"\n    \"post_title\" =\u003e \"Lorem ipsum dolor sit amet\"\n    ...\n  ]\n}\n```\n\n### Advanced Custom Field, Field Keys\n\nAdd the follwing PHP script to your WordPress theme's `function.php`. This script will append a button `Transfer Advanced Custom Field Accessor Keys` to the `Multilingual Content Seup` section. This action button will toggle all `_field_key` as `copy` for you.\n\n![Multilingual Content Seup](docs/images/multilingual_content_seup.png)\n\n```php\n  function acf_admin_script()\n  { ?\u003e\n\n    \u003c!-- Update Admin Script For Advanced Custom Field --\u003e\n    \u003cscript src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js\"\u003e\u003c/script\u003e\n    \u003cscript type=\"text/javascript\"\u003e\n\n      /**\n      * Advanced Custom Field Accessor key copy tools\n      */\n\n      $(document).ready(function() {\n        $('#icl_div_config #icl_mcs_details p').prepend('\u003ca onclick=\"apply_acf_accessor()\" class=\"preview button\"\u003eTransfer Advanced Custom Field Accessor Keys\u003c/a\u003e')\n      });\n\n      function apply_acf_accessor() {\n        var table = $('#icl_div_config #icl_mcs_details table tbody');\n        var expression = /^_[\\d\\S]+/;\n        var rows = table[0].rows;\n\n        for (var i = 0; i \u003c rows.length; i++) {\n          var element = $(rows[i]);\n          var validator = $(rows[i]).find('td[id]')[0].textContent;\n\n          if (expression.test(validator)) {\n            $(element).css({\n              background: 'rgba(207, 73, 68, 0.3)'\n            }).find('td').css({\n              color: '#333'\n            });\n            $(element).find('td[align] label:nth-child(2) input').prop('checked', 'checked');\n          }\n\n        }\n      }\n\n    \u003c/script\u003e\n\n  \u003c?php }\n  add_action('admin_enqueue_scripts', 'acf_admin_script');\n\n```\n\n### License\n[![license](https://img.shields.io/github/license/peakhmr/wpml.svg?style=flat-square)](LICENSE)\n\u003c!-- [![Packagist](https://img.shields.io/packagist/v/peakhmr/wpml.svg?style=flat-square)](https://github.com/peakhmr/wpml/releases) --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocheatsok78%2Fcorcel-wpml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocheatsok78%2Fcorcel-wpml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocheatsok78%2Fcorcel-wpml/lists"}