Skip to content

Instantly share code, notes, and snippets.

View fikrirasyid's full-sized avatar
💭
writing commit messages

Fikri Rasyid fikrirasyid

💭
writing commit messages
View GitHub Profile
@fikrirasyid
fikrirasyid / gist:6c5fdaf5f094779938f0
Created April 27, 2015 10:43
EDITED - Gruntfile.js for making .zip file for WordPress theme
'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: {
@fikrirasyid
fikrirasyid / gist:95c12103753f9f2352ca
Last active August 29, 2015 14:19
Gruntfile.js for making .zip file for Patio theme
'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: {
@fikrirasyid
fikrirasyid / gist:83e67de47feeb8fc8ba6
Created March 12, 2015 02:15
Ajaxifying Comment - Send Comment as AJAX Call
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);
@fikrirasyid
fikrirasyid / gist:d9e83deb4e73fa964d72
Created March 12, 2015 02:14
Ajaxifying Comment - Add "submitting comment" message:
/**
* 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' );
@fikrirasyid
fikrirasyid / gist:7242efb1b8359d23f619
Last active August 29, 2015 14:16
Ajaxifying Comment - Load Javascript script & its Javascript params
/**
* 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' );
@fikrirasyid
fikrirasyid / SassMeister-input.scss
Created February 8, 2015 00:28
Generated by SassMeister.com.
// ----
// Sass (v3.4.11)
// Compass (v1.0.3)
// ----
$color: #F44336;
$darken: darken( $color, 10% );
$lighten: lighten( $color, 10% );
.box{
@fikrirasyid
fikrirasyid / gist:e64490a0f8784e7d3635
Created February 5, 2015 16:21
Force All Pages to Use HTTPS Using WordPress HTTPS Plugin
function force_ssl_for_all( $force_ssl, $post_id = 0, $url = '' ){
return true;
}
add_filter( 'force_ssl', 'force_ssl_for_all', 10, 3 );
@fikrirasyid
fikrirasyid / WordPress: replace the_excerpt's [...] + change its words length
Created January 16, 2015 02:59
WordPress: replace the_excerpt's [...] + change its words length
/**
* Modifying excerpt's length
*
* @return int
*/
function yourtheme_excerpt_length(){
return 20;
}
add_filter( 'excerpt_length', 'yourtheme_excerpt_length' );
@fikrirasyid
fikrirasyid / Randomizing WP_Query's Posts Order
Created October 5, 2014 10:21
Randomizing WP_Query's Posts Order
/**
* 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 );
@fikrirasyid
fikrirasyid / gist:695c155cdd4ee78760fc
Created September 12, 2014 06:01
WordPress - Modifying URL's Query String, The Easy Way
/**
* 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() ){