2018년 7월 23일 월요일

Wordpress tips

Child theme's Javascript file is loaded earlier than parent theme's.

For example, global-child.js is loaded right after jquery-min.js loaded and global.js of the parent theme is located at the bottom of <body> tag in the code.


In child theme, JQuery variables without $ should be declared and defined in the $(document).ready().

Weirdly some variables were found 'undefined' in the debugger, if they are defined before/out of $(document).ready()  just like twenty seventeen theme's global.js.


Firing a code after a jquery animation:

    code it in the callback function of animation().

Firing a code after a CSS transition, for instance, 'transition: 0.6s ease' which is triggered by something like addClass( 'fade-in' ) call:

    $("#selector").one("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){ ... });

.one() means running the callback only once.

Source: https://stackoverflow.com/questions/9255279/callback-when-css3-transition-finishes


Loading a page/post-specific Javascript:
    function load_scripts() {
    global $post;
    if ( is_page() || is_single() ) {
        switch( $post->post_name ) {
            case 'home':
                wp_enqueue_script( 'home', get_template_directory_uri().'/js/home.js', array( 'jquery' ), '', false);
            case 'about-page':
                wp_enqueue_script( 'about', get_template_directory_uri().'/js/about-page.js', array( 'jquery' ), '', false);
        }
    }
    add_action( 'wp_enqueue_scripts', 'load_scripts' );

Source: https://wordpress.stackexchange.com/questions/67802/most-efficient-way-to-add-javascript-file-to-specific-post-and-or-pages



2018년 7월 8일 일요일

When Excel Prints Gray or Light-gray Colored Text in Black

(ver. MS-Office 2013)

File
Print
Page Setup (<- under the printing options)
Sheet tab
Option button (<- will lead you to Printing Preferences, but don't go there via Control Panel)
Print Quality tab
Advanced button
Print colored texts and borders in black to Disabled (<- this text is not exactly same to this, anyway disable it)

Ok, Ok, Apply, Ok, ... boom!

Xubuntu: Installing a Printer (Canon G3060 PIXMA)

$ sudo apt install system-config-printer Download the proper driver for linux from Canon website. Turn on the printer and set up its WiFi. C...