Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author gongwan33

    (@gongwan33)

    Thanks 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!

    Thread Starter gongwan33

    (@gongwan33)

    Thank 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

    • This reply was modified 8 years, 1 month ago by gongwan33.
    • This reply was modified 8 years, 1 month ago by gongwan33.

    Plugins 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.

    It 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

    I 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.

Viewing 5 replies - 1 through 5 (of 5 total)