gongwan33
Forum Replies Created
-
Forum: Plugins
In reply to: [Translator with Baidu Service] Great plugin with few bugsThanks for your feedback. I will look into the problems you mentioned and solve them in the next version.
It would be very helpful for me to fix the bugs,if you give me the url of your site.
Thanks again!Forum: Developing with WordPress
In reply to: adding query var makes front page missingThank you very much for your reply.
For some reason, add_rewrite_endpoint doesn’t work for my site. Finally I found a solution. It’s a little complicated, but it works.First, get the query var manually.
$this->base_path = parse_url(get_site_url())[‘path’];
preg_match(‘@’.$this->base_path.’\/(en|da|zh)\/?$@’, $_SERVER[‘REQUEST_URI’], $matches);$this->qv = $matches[1];
Second, check the page type. If it is not the home page, add the customized query var. if it is the home page, DON’T ADD IT.
if(empty($this->qv) && rtrim($this->base_path, ‘/’) != rtrim($_SERVER[‘REQUEST_URI’], ‘/’)){
add_filter( ‘query_vars’, array($this, ‘add_custom_page_variables’) );}
Finally, add the rewrite rules to validate the customized URL.
global $wp_rewrite;
$extra_rule[‘(‘.$this->langs_rex.’)/?$’] = ‘index.php?lang=$matches[1]’;
$wp_rewrite->rules = $extra_rule + $wp_rewrite->rules;
$wp_rewrite->flush_rules();The last but not least, before all of these steps, the URL autocompletion function must be turned off, or the page will be directed to somewhere else. To turn off the function, please refer to https://geekwagner.blogspot.com/2017/02/wordpress-about-url-autocompletion.html
Forum: Developing with WordPress
In reply to: how to include 3rd party code in pluginPlugins must use GPL license. Even though you can charge for some of the services in your plugin, it doesn’t mean you can protect your code by license.
Forum: Developing with WordPress
In reply to: Remove a field title from a widgetIt depends on your widget code.
In your widget code, the function widget( $args, $instance ) of WP_Widget will be reloaded. For example:class your_widget_class extends WP_Widget { public function widget( $args, $instance ) { extract( $args ); $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); echo $before_widget; <strong> echo empty( $instance['title'] ) ? '' : $before_title . $instance['title'] . $after_title;<em>//This line will judge whether the empty title should be displayed. if your widget doesn't do something like this, the title will always be displayed</em></strong> if ( ! $output = apply_filters( 'baidu_translator_widget_output', '', $instance, $args ) ) { baidu_translator( $instance ); } echo $after_widget; }
- This reply was modified 8 years, 1 month ago by Jan Dembowski. Reason: Code fix
Forum: Developing with WordPress
In reply to: Can’t customize WP admin barI have tried the selector #wpadminbar on the default twentysixteen theme and it works! Maybe you could clean your browser cache and try again or check the css code in the develop mode of your browser to make sure it has really replaced the old ones.