Ivan Antipov
Forum Replies Created
-
Forum: Plugins
In reply to: [Polylang] Polylang – switching language on the fly and duplicate URL'sBasically, we need to be able to set a language before the headers are sent, regardless of the URL. This is due to our load balancer setup, we made it look so it runs out of a subdirectory for SEO reasons (https://www.cheapflights.com/news/) whereas it’s actually hosted on a separate server and the load balancer forwards all /news/ traffic to it. With WPML, even though it’s set up as ‘domain per language’ it’s still not picking the language correctly, and so an extra check for the HTTP_HOST is needed.
What would it take to add the same URL feature? I could contribute to the plugin and find a solution myself – but could you point me in the right direction? The above code is sort of half-way there, I got it to save but then it will load only the first found post on the front-end and redirect the second, disregarding the language parameter.
Thanks.
Forum: Plugins
In reply to: [Polylang] Polylang – switching language on the fly and duplicate URL'sCould you please give a quick yes/no answer on the same URL slugs issue – we’re rolling out the new blog this week and this is a determining factor on whether we will use the plugin across all our blogs or not.
Forum: Plugins
In reply to: [Plugin: Front-end Editor] Custom fields on static pagesThanks man, I owe you a beer if you ever come to London.
Forum: Plugins
In reply to: [Plugin: Front-end Editor] Custom fields on static pagesMan this is perfect, do forgive my WordPress noobery. One last thing, when displayed, the text isn’t divided by paragraphs, is there some way I can wrap the output in wpautop() or something?
Forum: Plugins
In reply to: [Plugin: Front-end Editor] Custom fields on static pagesDid exactly that, the text is being displayed but is not wrapped, nothing new in the FE Editor settings. Something’s missing here, i.e. how does it know which content ID is being displayed?
Do you think you could implement something similar on your blog, I think a lot of folks would find this very useful.
Forum: Plugins
In reply to: [Plugin: Front-end Editor] Custom fields on static pagesThanks scribu, what I meant by custom fields was a block of text to be edited on a custom template – I’m still not too familiar with WordPress terminology.
Here’s my class:
<?php class frontEd_custom extends frontEd_field { protected $field; function setup() {} function wrap($content, $content_id = 0) { if ( ! self::check($content_id) ) return $content; return parent::wrap($content, $content_id); } function get($content_id) { $sql = new SQL(); $sql->query("select * from content where id=$content_id"); if($s = $sql->fetchObject()) return $s->content; else return null; } function save($content_id, $content) { $sql = new SQL(); $sql->query("UPDATE '".DB_NAME."'.'content' SET 'content' = '".$content."' WHERE 'content'.'id' = $content_id LIMIT 1;") return $content; } function check($content_id) { return current_user_can('edit_post', $post->ID); } } ?>
On the page:
<?php $sql = new SQL(); $sql->query("select * from content where id = 1"); if($s = $sql->fetchObject()) echo "<div class=\"front-ed\">$s->content</div>"; add_action('plugins_loaded', 'register_my_field'); function register_my_field() { register_fronted_field( $filter = 'the_filter', $class = 'frontEd_custom', $args = 'type=rich' ); } ?>
Again, I’m clueless on what
add_action
andregister_my_field()
do, or which filter to use.