This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function(grunt){ | |
// load all tasks | |
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'}); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
makepot: { | |
target: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function(grunt){ | |
// load all tasks | |
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'}); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
makepot: { | |
target: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
/** | |
* Ajaxify Comment Submission | |
* Assuming that comment form's ID is #commentform. Adjust it as you see fit | |
*/ | |
$('body').on('submit', '#commentform', function(e){ | |
// Stop the default form behavior | |
e.preventDefault(); | |
var commentform = $(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adding processing message at comment form | |
* Use inline style so we don't need to load more file | |
*/ | |
function simple_ajax_comment_form_mod( $settings ){ | |
printf( '<div id="submitting-comment" style="padding: 15px 20px; text-align: center; display: none;">%s</div>', __( 'Submitting comment...' ) ); | |
} | |
add_action( 'comment_form', 'simple_ajax_comment_form_mod' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Load the script | |
* Most of the time, the script will be used at is_singular(). Make this pluggable tho, just in case the single page is displayed as overlay on other page | |
*/ | |
function simple_ajax_comment_script(){ | |
if( apply_filters( 'simple_ajax_comment_is_used', is_singular() ) ){ | |
/** | |
* Load the js script | |
*/ | |
wp_enqueue_script( 'simple-ajax-comment-script', plugin_dir_url( __FILE__ ) . 'js/simple-ajax-comment.js' , array( 'jquery', 'jquery-form' ), '1.0.0' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.11) | |
// Compass (v1.0.3) | |
// ---- | |
$color: #F44336; | |
$darken: darken( $color, 10% ); | |
$lighten: lighten( $color, 10% ); | |
.box{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function force_ssl_for_all( $force_ssl, $post_id = 0, $url = '' ){ | |
return true; | |
} | |
add_filter( 'force_ssl', 'force_ssl_for_all', 10, 3 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Modifying excerpt's length | |
* | |
* @return int | |
*/ | |
function yourtheme_excerpt_length(){ | |
return 20; | |
} | |
add_filter( 'excerpt_length', 'yourtheme_excerpt_length' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Assuming you want 8 latest posts and excluding sticky posts | |
*/ | |
$posts_args = array( | |
'ignore_sticky_posts' => true, | |
'posts_per_page' => 8 | |
); | |
$posts = new WP_Query( $posts_args ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Modify URL's query string | |
* | |
* @param string url to be modified | |
* @param array of query strings | |
* | |
* @return string of modified url | |
*/ | |
function fr_modify_url( $url = '', $query_string_args = array() ){ |
NewerOlder