Forum Replies Created

Viewing 15 replies - 16 through 30 (of 56 total)
  • Thread Starter solagirl

    (@solagirl)

    Hi, please paste it into footer.php, right before the end of body tag.
    The code only works for gallery generated by nextgen gallery plugin. And also make sure jquery is loaded.
    It is a long time from when I posted the code, I’m not quite sure if it still works.

    Thread Starter solagirl

    (@solagirl)

    @ewdrobert, thanks for sharing the useful information. I didn’t notice the recent Google’s algorithm update.

    Thread Starter solagirl

    (@solagirl)

    @ewdrobert, I didn’t use this plugin months ago. My solution did stopped those abnormal keywords, but I thought well maybe I should spend more time concerning about writing instead of those SEO tricks. So I uninstalled this plugin, my traffic is not much but I didn’t notice any significant decline as well.

    Thread Starter solagirl

    (@solagirl)

    The code I provided earlier was found a bug, it does not work when there are more than one product in the cart. So here is an updated version. It takes care the condition of multiple products and converts shipping cost.

    add_filter('woocommerce_paypal_args', 'convert_rmb_to_usd');
    function convert_rmb_to_usd($paypal_args){
        if ( $paypal_args['currency_code'] == 'RMB'){
            $convert_rate = 6.2116; //Set converting rate
            $count = 1;
            while( isset($paypal_args['amount_' . $count]) ){
                $paypal_args['amount_' . $count] = round( $paypal_args['amount_' . $count] / $convert_rate, 2);
                $count++;
            }
        }
        return $paypal_args;
    }
    Thread Starter solagirl

    (@solagirl)

    I think you can try something like this, put it in your theme’s functions.php

    add_filter(‘woocommerce_paypal_args’, ‘convert_rmb_to_hkd’);
    function convert_rmb_to_hkd($paypal_args){
    if ( $paypal_args[‘currency_code’] == ‘RMB’){
    $convert_rate = 0.8; //set the converting rate
    $paypal_args[‘currency_code’] = ‘HKD’; //change RMB to HKD
    $paypal_args[‘amount_1’] = round( $paypal_args[‘amount_1’] / $convert_rate, 2);
    }
    return $paypal_args;
    }

    @own3mall Hey, I think what you mentioned are dealing with how to create ckeditor plugins or add a plugin in the ckeditor way. But to add buttons to CKEditor For WordPress plugin’s toolbar, you need to use the WordPress way.

    There are two filters you can use to load your custom ckeditor plugin and button.
    ckeditor_external_plugins – load custom plugins
    ckeditor_buttons – load custom buttons

    Use them together you can add your plugin, here is an example. But beware that this only adds buttons to the editor in back end. It can’t change anything for comment area editor. To modify the comment editor, it’s better to use ckeditor.config.js in my opinion.

    add_action('init', 'custom_ckeditor_interface');
    function custom_ckeditor_interface(){
    	add_filter( 'ckeditor_external_plugins', 'register_custom_ckeditor_plugins' );
    	add_filter( 'ckeditor_buttons', 'register_custom_ckeditor_buttons' );
    }
    //Load external ckeditor plugins
    function register_custom_ckeditor_plugins( $plugins ){
    	$plugins['your_plugin_name_1'] = 'your_plugin_uri_1';
    	$plugins['your_plugin_name_2'] = 'your_plugin_uri_2';
    	return $plugins;
    }
    //Add more buttons
    function register_custom_ckeditor_buttons( $buttons ){
    	$buttons[] = array('button_1');
    	$buttons[] = array('button_2');
    	return $buttons;
    }

    The plugin name and button name are defined in your ckeditor plugin scripts(eg. plugin.js)

    Plugin Author solagirl

    (@solagirl)

    Hi, I’m a Chinese girl so I write in Chinese. Never mind, if you need any help I can always communicate with you in English. Thanks for dropping by.
    I will send you my email address so you can reach me by email without the barrier of language.

    Plugin Author solagirl

    (@solagirl)

    Hey, never mind. That’s a good habit to help getting the best choice. If you have any interesting problem to solve, don’t forget to leave a message on my blog.

    Plugin Author solagirl

    (@solagirl)

    I’m just glad the problem is solved, I learned a lot from helping you, thank you.

    Plugin Author solagirl

    (@solagirl)

    Hi,

    I’m sorry but I’ve never heard of Mollom, let alone use it. From what you described, I think the plugin might have filtered comment content which we can’t control. Are you using its WordPress Plugin (https://www.ads-software.com/extend/plugins/wp-mollom/) BTW? I can see it is an out-of-date plugin, the newest version is on github. I always use Akismet alone to fight spam comments. If you truly need that plugin, the best way is to get help from its author, ask how the plugin filtered the comment content.

    Plugin Author solagirl

    (@solagirl)

    Hi there,

    I have no success with wp syntaxhighlighter plugin as well, so just leave it.

    For the last problem you mentioned, ckeditor plugin destroyed the editor instance and then reinitialized it when reply link is clicked. This makes my method stop working unless threaded comment is disabled which in my mind is not what you desire. So the only way I found is to modify CKEditor plugin’s config file, CKEditor plugin doesn’t provide a way to use user custom config file, this is what makes simple things complicated.

    I have detailed the method on my demo page and also updated my demo, please take a look.

    Plugin Author solagirl

    (@solagirl)

    Thanks for finding the problem.
    I missed one important factor that WordPress does not allow pre tag in comment, to fix this, put the code below into functions.php

    add_filter('preprocess_comment','allow_tags_in_comments');
    function allow_tags_in_comments($data) {
    	global $allowedtags;
    	$allowedtags['pre'] = array('class'=>true);
    	return $data;
    }

    I have updated my demo, you can try again.

    My solution is https://www.ads-software.com/extend/plugins/syntaxhighlighter/
    The button should also work for unregistered users.

    Plugin Author solagirl

    (@solagirl)

    Hi, I create a demo of ckeditor with code button in comment area here, check it out if you are interested.

    Plugin Author solagirl

    (@solagirl)

    Hi, If you use the code I gave you, you can get the Code button, it works exactly the same as in the back end. For WP SyntaxHighlighter, Select Higlight your code in comments, then remove the text link.

    I’m sorry if you’d prefer a plugin, it needs more thinking before implementing it, as CKEditor For WordPress plugin is the real boss.

    Plugin Author solagirl

    (@solagirl)

    Hi,
    CKEditor For WordPress plugin provide no easy way to load external plugins in the comment area, so I’m not sure if it is a good idea to add the code button at default.

    Here is a quick method if you need the code button in the comment area.

    Copy and paste the code below into your theme’s functions.php

    add_action('wp_footer', 'custom_comment_editor_button',100);
    function custom_comment_editor_button(){
        if( !is_admin() && (is_page() || is_single()) && comments_open() ){
            $options = get_option('ckeditor_wordpress');
            if( $options['appearance']['comment_editor'] == 't'){
        ?>
              <script type="text/javascript">
                  CKEDITOR.config.extraPlugins += ( CKEDITOR.config.extraPlugins ? ',syntaxhighlight' : 'syntaxhighlight' );
                  CKEDITOR.plugins.addExternal('syntaxhighlight', '<?php echo WP_PLUGIN_URL; ?>/syntaxhighlighter-ckeditor-button/syntaxhighlight/');
                  CKEDITOR.replace( 'comment', {
                        toolbar: [
                            { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Strike', '-', 'RemoveFormat' ] },
                            { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight'] },
                            { name: 'links', items: [ 'Link', 'Unlink' ] },
                            { name: 'insert', items: [ 'Image', 'SpecialChar','Code' ] }
                        ],
                        height:'160px',//The height of the comment editor
                        uiColor:'#ffffff' //The ui color of the comment editor
                });
              </script>
        <?php
            }
        }
    }

    I have to redefine the toolbar button in order to insert the code button. You can change the editor’s height and toolbar color by setting ‘height‘ and ‘uiColor‘ in the code. And if you use the code above, you will define ‘comment toolbar‘ and ‘editor height for comment‘ here instead of CKEditor->Basic Settings.

    Now you should have the code button in the comment area, however, if you also want the syntaxhighlighter effect, Auto Syntaxhighlighter couldn’t do the job.

    You might consider removing that plugin and install WP SyntaxHighlighter or SyntaxHighlighter Evolved.

    For WP SyntaxHighlighter, choose when to load the brushes at settings->WP SyntaxhigHlighter

    For SyntaxHighlighter Evolved, go to settings->SyntaxHighlighter and select “Load All Brushes”.

    I do not recommended to do this as brush files will be loaded even though they might be useless for the current page. You can just style the pre tag in your style.css to give it a nice look and most of the themes have already done the job.

    I’m sorry for all the trouble, I’m not sure it is best to merge the code into my plugin as it breaks CKEditor For WordPress plugin’s function.

Viewing 15 replies - 16 through 30 (of 56 total)