This file contains hidden or 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
<?php | |
/** | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
This file contains hidden or 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
<?php | |
// Disable support for comments and trackbacks in post types | |
function df_disable_comments_post_types_support() { | |
$post_types = get_post_types(); | |
foreach ($post_types as $post_type) { | |
if(post_type_supports($post_type, 'comments')) { | |
remove_post_type_support($post_type, 'comments'); | |
remove_post_type_support($post_type, 'trackbacks'); | |
} |
This file contains hidden or 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
/** | |
* Create directory and init as --bare repo | |
*/ | |
mkdir repo && cd repo | |
mkdir site.git && cd site.git | |
git init --bare | |
/** |
This file contains hidden or 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
<?php | |
/** | |
* _s Theme Options | |
* | |
* @package _s | |
* @since _s 1.0 | |
*/ | |
/** | |
* Register the form setting for our _s_options array. |
This file contains hidden or 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
<?php | |
/** | |
* Replace string with pattern | |
* (example use: for mail templating) | |
* | |
* @codes array(); | |
* @pattern string; | |
*/ | |
$message = 'coba username {username} atau {user_email}'; |
This file contains hidden or 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
<?php | |
function custom_bp_nav() { | |
global $bp; | |
bp_core_new_nav_item( | |
array( | |
'name' => __( 'Site Settings', 'buddypress' ), | |
'slug' => 'site-settings', | |
'position' => 80, | |
'screen_function' => 'site_settings_screen', |
This file contains hidden or 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
#!/bin/bash | |
### change the values below where needed..... | |
### taken from http://moinne.com/blog/ronald/mysql/backup-large-databases-with-mysqldump | |
DBNAMES="MyDb1 MyDb2 MyDb3" | |
HOST="--host=localhost" | |
USER="--user=root" | |
PASSWORD="--password=MyPassword" | |
BACKUP_DIR="/MyBackupDirectory" | |
#### you can change these values but they are optional.... |
This file contains hidden or 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
#rewrite all subdomain on old domain to subdomain on new domain | |
RewriteCond %{HTTP_HOST} ^(.*)\.olddomain\.com$ [NC] | |
RewriteRule ^(.*)$ http://%1.newdomain.com/$1 [R=301,L] | |
# rewrite all links to new domain | |
RewriteEngine on | |
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L] | |
This file contains hidden or 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
## Run on server | |
alias git-receive-pack="/usr/local/cpanel/3rdparty/bin/git-receive-pack" | |
## I still need to add it to my ~/.bashrc | |
export PATH=$PATH:"/usr/local/cpanel/3rdparty/bin" | |
## Also, on a side note the whole stdin: is not a TTY error can be fixed by removing the /home/git/.bashrc file. |
This file contains hidden or 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 _getPostByCategory($post_type, $category_slug){ | |
global $wpdb; | |
$query = "SELECT p.*, terms.term_taxonomy_id, terms.term_id, terms.slug, terms.name from $wpdb->posts p INNER JOIN | |
( SELECT rel.object_id , rel.term_taxonomy_id, term.term_id, term.name, term.slug FROM $wpdb->term_relationships rel | |
INNER JOIN (SELECT ttax.term_taxonomy_id, ttax.term_id, t.name, t.slug FROM $wpdb->term_taxonomy ttax | |
INNER JOIN $wpdb->terms t ON t.term_id = ttax.term_id | |
) term | |
ON rel.term_taxonomy_id = term.term_taxonomy_id ) terms | |
ON p.ID = terms.object_id |