berryblue031
Forum Replies Created
-
Forum: Plugins
In reply to: [Polylang] [Plugin: Polylang] How to query for posts in the page language?You know I would have actually preferred to use the list version of the widget instead of the dropdown, but I didn’t know how to make it layout horizontally. Is it possible?
Forum: Plugins
In reply to: [Polylang] [Plugin: Polylang] How to query for posts in the page language?Ahhh that is perfect! Thank you.
It’s really great how fast you are at responding on the forum ??Forum: Plugins
In reply to: [Polylang] [Plugin: Polylang] How to query for posts in the page language?Back to topic of the category is it really necessary to hard-code the category id (I was hoping to avoid that). I was kinda hoping there would be a function called getAlternateLanguage($cat_id, get_locale()); that would then return the id of the category in the proper language? I have linked the categories together as language alternatives of each other.
Forum: Plugins
In reply to: [Polylang] [Plugin: Polylang] How to query for posts in the page language?The theme is available to download you can get it here, it includes documentation about setting the permalinks
https://www.themeskingdom.com/en/page/Widely/229/themeThe first problem I had with it, is it requires a staic frontpage and uses is_front_page() in header.php to do special stuff on the front page,but when using your plugin there are multiple front pages (one for each language) and is_front_page was returning false on these pages – to get around this I ended up pulling all the code out of the themes front-page.php and putting it in a template called _front.php, then changing the is_front_page() calls to is_page_template(‘_front.php’), ideally is_front_page() would have returned true for all language versions of the front page.
And the second problem was with your language drop down, when I used it the pages didn’t work at all when referenced with /language/da, and the dirty hack I had to do for that was change the all my front pages to be called “en-home.php” , “da-home.php” etc, and then “modify” your Polylang_Widget href to use my naming scheme instead which is really ugly
// $url = home_url('?lang='); $url = home_url(''); ... if (this.value == '$default') location.href = '$home_url'; else { //location.href ='$url'+this.value; location.href = '$home_url' + '/' + this.value +'-home/'; }
Forum: Plugins
In reply to: [Polylang] [Plugin: Polylang] How to query for posts in the page language?For berryblue031, it would be a bit more complex as each category is normally affected one unique language.
I can easily make a category for each language. But the theme only allows me to input one category via it’s control panel.
So using that approach given a category id
$cat = get_option(THEME_NAME.'_slider_category'); //this returns an integer
How can I get the id of the related category in the language of the current page?If there is no ‘nice’ way of doing it I guess I will just have to hack into your cookie variable and hardcode the category id based on it’s value. Though I would rather not have to hack it… I already had to make some hacks because the theme I am stuck with depends on a specific permalink format that your language drop down doesn’t respect and my php / wordpress skills aren’t good enough to modify the theme so I went with the easier route.
Ironically I am a professional C++ developer and some how that meant I have the skills and should make a website for my mother-in-laws bed and breakfast :P..