Skip to content

Instantly share code, notes, and snippets.

@karrikas
karrikas / wordpress-force-404.php
Created September 17, 2015 10:22
Wodpress force 404
header("HTTP/1.0 404 Not Found - Archive Empty");
$wp_query->set_404();
require TEMPLATEPATH.'/404.php';
exit;
@karrikas
karrikas / functions.php
Created September 17, 2015 12:53
Wordpress list hooked functions
<?php
function list_hooked_functions($tag=false){
global $wp_filter;
if ($tag) {
$hook[$tag]=$wp_filter[$tag];
if (!is_array($hook[$tag])) {
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
return;
}
} else {
@karrikas
karrikas / .vimrc
Last active September 18, 2015 21:10
Vim configuracion
" Vundle instalatu lehengo
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
@karrikas
karrikas / build.xml
Last active September 21, 2015 12:43
Custom task to clean wordpress serialized information in dump file
<project name="xxx" default="dist">
<target name="_init_wp_serialize">
<adhoc-task name="wp-serialize-clean"><![CDATA[
class Wp_Serialice_Update extends Task {
private $file;
function setFile($file) {
$this->file = $file;
}
@karrikas
karrikas / .gitignore
Last active December 20, 2016 10:00
Gitignore for wordpress project
# Ignore everything in the root except the "wp-content" directory.
/*
!.gitignore
!wp-content/
!build.xml
!build_rsync_exclude
# Ignore everything in the "wp-content" directory, except the "plugins" and "themes" directories.
wp-content/*
!wp-content/plugins/
@karrikas
karrikas / url-finder
Created October 1, 2015 14:52
Find url from entire website
<?php
class urlfinder {
var $urls = array();
var $visited = array();
var $domain;
public function get ($url, $domain = '') {
if (in_array($url, $this->visited)) {
@karrikas
karrikas / build.xml
Last active June 15, 2017 17:44
Build file for deploy wordpress project from local to production server.
<?xml version="1.0" encoding="UTF-8"?>
<project name="wordpress" default="deploy">
<target name="deploy">
<propertyprompt propertyName="rsync.type" promptText="Deploy? (test or yes)" defaultValue="test" />
<if>
<equals arg1="${rsync.type}" arg2="yes" />
<then>
<exec command="rsync --exclude-from='rsync_exclude' -e 'ssh -p 333' --delete-after -razv . sshuser@host.com:/final/path" outputProperty="info" />
@karrikas
karrikas / dropt-tables-with-foreign-keys.sql
Created November 22, 2015 07:53
Drop tables with foreign keys in mysql
SET FOREIGN_KEY_CHECKS = 0;
drop table if exists customers;
drop table if exists orders;
drop table if exists order_details;
SET FOREIGN_KEY_CHECKS = 1;
@karrikas
karrikas / functions-woocommerce-theme.php
Created January 11, 2016 14:01
Woocommerce integracion in a theme
<?php
// remove plugin default integration
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
// disable breadcrumbs (optional)
remove_action( 'woocommerce_before_main_content','woocommerce_breadcrumb', 20, 0);
// add defatul shop layaout
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
@karrikas
karrikas / .vimrc
Last active May 13, 2016 06:30
Syntastic optoins - vim
# https://github.com/scrooloose/syntastic
let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:loaded_syntastic_php_phpcs_checker = 0
let g:loaded_syntastic_php_phplint_checker = 0
let g:loaded_syntastic_php_phpmd_checker = 0