humanmade / humanmade/page-for-post-type

Support Polylang

Open
#17 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
188
Forks
30
PR merge metrics
No merged PRs in 30d

Description

Hi! This is an amazing plugin which we use almost in every site, thanks!

There are a few things that are bugging me, related to compatibility with Polylang:

- CPT archive page slugs need to be translated in Polylang "Strings translations" tool to exactly same as the translated archive page slug is. I'd like to find a robust solution for this, or at least give the user a reminder about this
- menus do not get `current-menu-item` etc classes for translated archive pages, I have a small workaround for that to be put in `filter_wp_nav_menu_objects` function after `$page_ids` is set

```php
if ( function_exists( 'pll_current_language' ) ) {
if ( pll_current_language() !== pll_default_language() ) {
foreach ( $page_ids as $tmp_page_id_key => $tmp_page_id ) {
$page_ids[ $tmp_page_id_key ] = pll_get_post( $tmp_page_id );
}
}
}
```

I'm wondering, do you accept PR's for this kind of compatibility issues or should I create a plugin for Polylang compatibility?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the plugin's filter_wp_nav_menu_objects function and the Polylang functions shown in the issue. Reproduce the translated CPT archive and menu behavior, then determine whether both translated slugs and current-menu-item classes can be supported. Done means an agreed compatibility behavior is implemented or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.