In single.php, after content code
get_template_part( 'template-parts/post/content', get_post_format() ); // content code
there is the code for post navigation (means links to move between this and that posts)
the_post_navigation(
array(
'prev_text' => '...' . '...',
'next_text' => '...' . '...',
)
);
it shows two links for the previous post and next one of the current post at the bottom of the screen,
however, the problem is when you click/tab the links again and gain, you find the links include any posts from all different categories, just in order of their written date and time.
Here is the way to move among only one category, even though you keep clicking/tabbing the prev/next links.
the_post_navigation(
array(
'prev_text' => '...' . '...',
'next_text' => '...' . '...',
'in_same_term' => true,
'taxonomy' => 'category',
)
);
Yup, adding that two lines are all.
Happy wordpressing!
2019년 10월 18일 금요일
2019년 7월 31일 수요일
Chrome: How to prevent Chrome open pdf / Open pdf with your pdf viewer in Chrome downloads list
Chrome ver. 79.x.xxx
- chrome:settings
- Search 'pdf' in the box
- Click 'Site Settings'
- Click 'PDF documents' near the bottom
- Enable 'Download PDF files instead of automatically opening them in Chrome'
No option of 'Click to open embedded PDFs' in the current version (79.0.3945.130)
Google Chrome
How to prevent Chrome open pdf / Opening pdf with your pdf viewer in Chrome downloads list
Type 'about:flags' in the address barType 'pdf' in Search flags boxFind 'Click to open embedded PDFs' (it's at the top with ver. 75.0.3770.142.)Change 'Default' menu to 'Disabled'Click 'Relaunch' button (caution: you might lose all open sites/tabs unless it's set up as 'Continue where you left off' in 'On startup' category of Settings.)
구글 크롬
크롬에서 pdf 파일 열리는 걸 방지하는 방법 / 크롬 다운로드 리스트에서 pdf 클릭해도 내 기본 pdf 뷰어에서 열리도록 하기
주소창에 'about:flags' 입력Flag 검색창에 'pdf' 입력'Click to open embedded PDFs' 항목 찾기 (ver. 75.0.3770.142에서 맨 위로 검색됨)'기본값'을 '비활성'으로 바꿈'재실행' 버튼 눌러서 크롬 재시작 (경고: 열려있는 모든 탭/사이트를 잃을 수도 있음, 설정에서 '지난 번 탭 유지'가 되어 있지 않으면.)
2019년 7월 9일 화요일
Customizing Windows 7 for a Happier Life
For more PRODUCTIVE MS Windows
MS Windows 7 is a weak OS and I've never thought it's user-friendly because a user should touch many miscellaneous parts to make it usable or productive.This article is about some tips including how to bring my apps or windows back onto the screen automatically after restart of Windows 7 for higher productivity.
Open 'My Computer', not Libraries when Windows Explorer clicked
- Right click on the icon of Taskbar
- Right click again on the small Windows Explorer icon
- Properties
- Type at the end of the Target textbox content, ' shell:MyComputerFolder', without the small quotation marks, including the space at the beginning.
Bring opened Windows Explorer windows back after restart
- Go to Folder Options (via Control Panel, for instance)
- View tab at top
- Scroll down in 'Advanced settings:' area
- Check 'Restore previous folder windows at logon
- Don't close any Windows Explorers when shutdown/restart
Bring your always-used apps back after restart
- Click Start button
- Type 'shell:startup'
- Drag & drop (making shortcuts) any program you want from Start Menu or from the application's folder (for example, C:\Program Files\Sublime Text 3)
- If possible, make the app's settings as it opens/recover all opened files/tabs (for example, set up your Chrome/Firefox to open all tabs back when it starts)
Typing Tips after Start button
- shell:appdata to open hidden Appdata folder
- shell:startup to open Startup Programs folder
- shell:programfiles to open C:/Program Files folder
- appwiz.cpl to open Programs and Features dialogue
2019년 7월 3일 수요일
Grunt (sass, jshint, concat, uglify, watch)
Gruntfile.js
module.exports = function( grunt ) {
var dir_theme = 'wp-content/themes/2017-child/',
dir_js = 'wp-content/themes/2017-child/assets/js/';
grunt.initConfig({
pkg: grunt.file.readJSON( 'package.json' ),
concat: {
// options: {
// separator: ';'
// },
dist: {
src: [dir_js + 'src/**/*.js',
'!' + dir_js + 'src/*-long.js',
'!' + dir_js + 'src/concatenated.js'],
dest: dir_js + 'src/concatenated.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */'
},
dist: {
src: // 'style.css': ['style.scss', '<%= concat.dist.dest %>'],
['<%= concat.dist.dest %>'],
dest:
dir_js + '<%= pkg.name %>.js'
}
},
// qunit: {
// files: ['bl-page-content/**/*.html']
// },
jshint: {
files: [dir_js + 'src/**/*.js',
dir_js + 'global.js',
'!<%= concat.dist.dest %>'],
options: {
// verbose: true,
'-W004': true,
'-W030': true,
esversion: 6,
globals: {
jQuery: true,
console: true,
module: true,
// document: true
}
}
},
sass: {
options: {
sourceMap: true
},
dist: {
src: dir_theme + 'style.scss',
dest: dir_theme + 'style.css'
}
},
watch: {
sass: {
files: dir_theme + 'style.scss',
tasks: ['sass']
},
jshint: {
files: ['<%= jshint.files %>'],
tasks: ['jshint']
}
}
});
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
// grunt.loadNpmTasks( 'grunt-contrib-qunit' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-sass' );
// grunt.registerTask( 'test', ['jshint', 'qunit']);
// grunt.registerTask( 'default', ['sass', 'jshint', 'qunit', 'concat', 'uglify']);
grunt.registerTask( 'js', ['jshint']);
grunt.registerTask( 'default', ['sass', 'jshint', 'concat', 'uglify']);
grunt.registerTask( 'cu', ['concat', 'uglify']);
};
module.exports = function( grunt ) {
var dir_theme = 'wp-content/themes/2017-child/',
dir_js = 'wp-content/themes/2017-child/assets/js/';
grunt.initConfig({
pkg: grunt.file.readJSON( 'package.json' ),
concat: {
// options: {
// separator: ';'
// },
dist: {
src: [dir_js + 'src/**/*.js',
'!' + dir_js + 'src/*-long.js',
'!' + dir_js + 'src/concatenated.js'],
dest: dir_js + 'src/concatenated.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */'
},
dist: {
src: // 'style.css': ['style.scss', '<%= concat.dist.dest %>'],
['<%= concat.dist.dest %>'],
dest:
dir_js + '<%= pkg.name %>.js'
}
},
// qunit: {
// files: ['bl-page-content/**/*.html']
// },
jshint: {
files: [dir_js + 'src/**/*.js',
dir_js + 'global.js',
'!<%= concat.dist.dest %>'],
options: {
// verbose: true,
'-W004': true,
'-W030': true,
esversion: 6,
globals: {
jQuery: true,
console: true,
module: true,
// document: true
}
}
},
sass: {
options: {
sourceMap: true
},
dist: {
src: dir_theme + 'style.scss',
dest: dir_theme + 'style.css'
}
},
watch: {
sass: {
files: dir_theme + 'style.scss',
tasks: ['sass']
},
jshint: {
files: ['<%= jshint.files %>'],
tasks: ['jshint']
}
}
});
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
// grunt.loadNpmTasks( 'grunt-contrib-qunit' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-sass' );
// grunt.registerTask( 'test', ['jshint', 'qunit']);
// grunt.registerTask( 'default', ['sass', 'jshint', 'qunit', 'concat', 'uglify']);
grunt.registerTask( 'js', ['jshint']);
grunt.registerTask( 'default', ['sass', 'jshint', 'concat', 'uglify']);
grunt.registerTask( 'cu', ['concat', 'uglify']);
};
2019년 4월 22일 월요일
Git and Github
$git init
$ssh-keygen
$ssh-add ~/.ssh/id_rsa
$git remote add origin SSH_URL_FROM_GITHUB
Set a ssh config file
$cat > ~/.ssh/config
Host github.com
Hostname github.com
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
(CTRL+D)
Set a basic path
$cat >> ~/.bash_profile
alias la='ls -a'
alias ll='ls -l'
HOME=/d/webhome/
HOMEDRIVE=D:/
HOMEPATH=\webhome
cd
(CTRL+D)
Avoiding ssh passphrase prompt
$cat >> ~/.bash_profile
eval `ssh-agent -s`
ssh-add ~/.ssh/*_rsa
(CTRL+D)
Patterned upload
$git checkout -b BRANCH_NAME
(coding)
$git status
$git diff FILENAME
$git add FILENAME
$git commit- m "COMMIT MSG FOR THE FILE"
$git push
(testing)
$git checkout master
$git merge BRANCH_NAME
(if needed)
$git branch -d BRANCH_NAME_TO_DELETE
Check commit id
$git log
Create a temporary branch to check old code
$ git checkout -b <temp_branch_name> <commit_id>
Going back to the current/final version
$ git checkout master
Rename a branch
$ git checkout BRANCH
$ git branch -m NEW_NAME
Cancel 'add'
$ git reset FILENAME
Check difference of an added file
$ git diff --cache FILENAME
$ssh-keygen
$ssh-add ~/.ssh/id_rsa
$git remote add origin SSH_URL_FROM_GITHUB
Set a ssh config file
$cat > ~/.ssh/config
Host github.com
Hostname github.com
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
(CTRL+D)
Set a basic path
$cat >> ~/.bash_profile
alias la='ls -a'
alias ll='ls -l'
HOME=/d/webhome/
HOMEDRIVE=D:/
HOMEPATH=\webhome
cd
(CTRL+D)
Avoiding ssh passphrase prompt
$cat >> ~/.bash_profile
eval `ssh-agent -s`
ssh-add ~/.ssh/*_rsa
(CTRL+D)
Patterned upload
$git checkout -b BRANCH_NAME
(coding)
$git status
$git diff FILENAME
$git add FILENAME
$git commit- m "COMMIT MSG FOR THE FILE"
$git push
(testing)
$git checkout master
$git merge BRANCH_NAME
(if needed)
$git branch -d BRANCH_NAME_TO_DELETE
Check commit id
$git log
Create a temporary branch to check old code
$ git checkout -b <temp_branch_name> <commit_id>
Going back to the current/final version
$ git checkout master
Rename a branch
$ git checkout BRANCH
$ git branch -m NEW_NAME
Cancel 'add'
$ git reset FILENAME
Check difference of an added file
$ git diff --cache FILENAME
2018년 12월 19일 수요일
preg_replace /e to preg_replace_callback
$onAttributes = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavaible', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragdrop', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterupdate', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmoveout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');
/*
* Bridge Light code 2018-12-19
* PHP7에서는 preg_replace() 첫번째 인수에서 /e가 폐기 되었으므로 대체 코드 투입: line 45~47 대신 line 48~56
*/
// $str = preg_replace('/<(.*?)>/ie',
// "'<' . preg_replace(array('/javascript:[^\"\']*/i', '/(" . implode('|', $onAttributes) . ")[ \\t\\n]*=/i', '/\s+/'), array('', '', ' '), stripslashes('\\1')) . '>'",
// $str);
$str = preg_replace_callback(
'/<(.*?)>/i',
function($matches) use ($onAttributes) {
return preg_replace(
array('/javascript:[^"\']*/i', '/('.implode('|', $onAttributes) . ')[ \\t\\n]*=/i', '/\s+/'),
array('', '', ' '),
stripslashes($matches[0]));
},
$str);
/*
* Bridge Light code 2018-12-19
* PHP7에서는 preg_replace() 첫번째 인수에서 /e가 폐기 되었으므로 대체 코드 투입: line 45~47 대신 line 48~56
*/
// $str = preg_replace('/<(.*?)>/ie',
// "'<' . preg_replace(array('/javascript:[^\"\']*/i', '/(" . implode('|', $onAttributes) . ")[ \\t\\n]*=/i', '/\s+/'), array('', '', ' '), stripslashes('\\1')) . '>'",
// $str);
$str = preg_replace_callback(
'/<(.*?)>/i',
function($matches) use ($onAttributes) {
return preg_replace(
array('/javascript:[^"\']*/i', '/('.implode('|', $onAttributes) . ')[ \\t\\n]*=/i', '/\s+/'),
array('', '', ' '),
stripslashes($matches[0]));
},
$str);
kimsq ver.1.2.2 (update 20140407)
file: _core/function/lib/getContent.lib.php
LIB_getContents() 함수에서 preg_replace()를 /e 지시자 때문에 preg_replace_callback으로 대체함.
preg_replace & preg_replace_callback, understood!
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.
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
피드 구독하기:
글 (Atom)
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...
-
After '# do-release-upgrade' from Ubuntu Server 12.04 LTS to 14.04 LTS On the dialog of grub setting, I just typed Enter with th...
-
My PC is built with Asrock Z68 Extreme4 gen3 which has a Marvell SATA3 (6G) chipset, and it has a problem that even though I disabled the SA...
-
Supported by Ine Hordvik In order to set the sync client language to English, t ry the following: Open your control panel Go to System ...