stratboy
Forum Replies Created
-
Forum: Plugins
In reply to: [Polylang] Any way to get translated post through WP REST API ?A REALLY RAW example to get lang content with custom routes, but it could be a starting point.
function get_lang_pages($data){ $posts = get_posts(array( 'post_type' => 'page' ,'lang' => $data['lang'] ,'showposts' => 10 )); if(empty($posts)){ return null; } return $posts; } add_action('rest_api_init', function(){ register_rest_route('yournamespace/v1', '/(?P<lang>.+)/pages', array( 'methods' => 'GET' ,'callback' => 'get_lang_pages' )//end options array ); });
Now, assuming you have english content other than default, just visit https://yoursite.com/wp-json/yournamespace/en/pages
Or, substitute ‘en’ with some other lang.
As I wrote, this is RAW, so one should for example use a better regexp to match ONLY language slugs, eventually add validation and error handling and so on…
Hope it helps
Forum: Plugins
In reply to: [Polylang] Any way to get translated post through WP REST API ?Same here: I really need a way to retrieve data based on language (including custom posts/taxonomies/metaboxes). The best thing should be teh ability to use the url part, just as always.. Ex.
https://mydomain.com/en/wp-json/wp/v2/pages/
or
https://mydomain.com/wp-json/en/wp/v2/pages/
Regards
Forum: Reviews
In reply to: [Sideways8 Simple Taxonomy Images] really well done for developers@jufahy hi, nothing particular, just used the plugin. But keep in mind that 10 months ago there were different wordpress and different woocommerce! So not sure the plugin’s still compatible. Try to contact the producers, maybe they’ll help you.
Are you a programmer?
Forum: Plugins
In reply to: [Polylang] Menu css not working after polylang@hakan6ok I’ve found the solution:
you MUST create a menu and assign position for EACH language (Appearence > menu). After doing that, wp_nav_menu comes back like it was before activating polylang.
Don’t know why, though.
@chouby: I think you should take a look and fix or at least make it VERY clear in documentation.
Regards
Forum: Plugins
In reply to: [Polylang] wp_nav_menu output totally changed after activationOk, the solution was to create and assign a menu for each language. (Appearence > menu) After doing it, for some reason wp_nav_menu output is right again.
Forum: Plugins
In reply to: [Polylang] Menu css not working after polylangSame problem here, the menu output is completely different after activating polylang.
Using poly 1.5.5 on wp 4.0, permalinks with post names, static home.
Forum: Plugins
In reply to: [Polylang] 1.5 occasional issuesPermalink settings: article name
Static front page: yes
Polylang settings: frankly to much to report, just ask me what you needThank you
Forum: Fixing WordPress
In reply to: thumbnail cropping never worked for me..the same. say that I have just cropped it, I click the button to set it as featured, then get to the post edit window and there I see the wrong image.
I tested for HOURS quite everything one can do..
Forum: Plugins
In reply to: [Polylang] Polylang changes urls: how to avoid/disable automatic redirect?Yesss!!! That filter lets me solve my problem without hacking the core! Thank you! ??
Forum: Plugins
In reply to: [Polylang] Polylang changes urls: how to avoid/disable automatic redirect?Hi. I noticed this: in class PLL_Frontend >
public function init() { $this->links = new PLL_Frontend_Links($this->links_model); $this->choose_lang = $this->options['force_lang'] && get_option('permalink_structure') ? new PLL_Choose_Lang_Url($this->links) : $this->choose_lang = new PLL_Choose_Lang_Content($this->links); }
If I comment out the PLL_Choose_Lang_Content initialization, I stop the auto-redirect.
2 more questions then:
– does it break something relevant? I mean: is it still fine for backoffice? Can I still manually query what I need?
– to stop auto redirect, is there any other better way that doesn’t imply core code hacking?
Thank you, regards
Forum: Hacks
In reply to: In admin, how can I say what custom post type I'm editing?Found an answer by myself. Anyway, I’d really like if someone could tell me if it’s a good way to achieve my goal or not.
$post_type = isset($_GET['post_type']) ? $_GET['post_type'] : (isset($_GET['post']) ? get_post_type($_GET['post']) : null );
I place this code in a funcion called by ‘load-post.php’ and ‘load-post-new.php’ hooks. I can then see if $post_type is == ‘my_custom_post_name’. It works.
The reason of the chained compressed if statement is that in the ‘post-new.php’ page I’ve got $_GET[‘post_type’], while in the ‘post.php’ page I can’t get it directly (at least it seems so.. There’s no $_GET[‘post_type’]), but I can get the post_type by passing the ID to get_post_type, and I get that ID with $_GET[‘post’].
OK. So, again, is this a good practice? Am I doing it the right way?
Forum: Themes and Templates
In reply to: list of years, exept current yearHEY, THIS IS DEFINITELY ONE OF THE WORST DEVELOPER FORUM I EVER USED! THE REALLY MOST OF MY THREADS DO NOT RECEIVE ANSWERS!
Such a BIG PLAYER like WP should definitely have a really, really better support forum, period.
Forum: Fixing WordPress
In reply to: Removing Custom Fieldswhy cf1? what does it mean?
Forum: Plugins
In reply to: wp_enqueue_script version problemno?
Forum: Plugins
In reply to: wp_enqueue_script version problempardon, so, the question: how can I effectively get the version written?