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
/** | |
* This functions Sends Post curl request | |
* @param string $url url where posts request is send | |
* @param array $post_data array containing post data with key value pairs | |
* @return string | |
*/ | |
function post_curl($url, $post_data){ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
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 to get wordpress date | |
*/ | |
function get_wp_date($date) { | |
return date('Y-m-d H:m:i', strtotime($date)); | |
} |
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
/* | |
* This is wordpress API for importing latest news from cnn ibn | |
* http://localhost/Sandbox/wordpress/wp-content/plugins/data_import/import_news18_images.php | |
*/ | |
//load wordpress functions | |
require_once("../../../wp-load.php"); | |
include 'functions.php'; | |
/** |
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
/* | |
Plugin Name: Admin mods | |
Description: This plugin removes unwanted items from wordpress admin panel | |
Version: 1.0 | |
Author: Ankit Agrawal | |
*/ | |
//function to add custom coloumns | |
add_filter( 'manage_edit-post_columns', 'my_columns_filter', 10, 1 ); | |
add_action( 'manage_posts_custom_column', 'my_column_action', 10, 1 ); |
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
/* | |
Plugin Name: Patti | |
Description: Modify Wordpress Add New Post for Adding Patti Data | |
Version: 1.0 | |
Author: Ankit Agrawal | |
*/ | |
/****************************************************************************/ | |
/************************* ADD PATTI CUSTOM FIELDS *************************/ | |
add_action( 'admin_init', 'patti_admin' ); |
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
-- phpMyAdmin SQL Dump | |
-- version 2.11.6 | |
-- http://www.phpmyadmin.net | |
-- | |
-- Host: localhost:3306 | |
-- Generation Time: Jan 11, 2013 at 04:24 PM | |
-- Server version: 5.0.51 | |
-- PHP Version: 5.2.5 | |
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
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
UPDATE | |
accounts_table | |
INNER JOIN | |
customers_table ON (accounts_table.user_id = customers_table.user_id) | |
SET | |
accountnumber = RTRIM(accountnumber) | |
WHERE | |
customers_table.customer_id = 'customer id'; | |
If you do not have many records in accounts_table, and you want to make sure that all the accountnumber values are trimmed, you can simply apply the trim to all the records as follows: |
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
DELETE n1 FROM names n1, names n2 WHERE n1.id > n2.id AND n1.name = n2.name | |
if you want to keep the row with the lowest id value OR | |
DELETE n1 FROM names n1, names n2 WHERE n1.id < n2.id AND n1.name = n2.name | |
DELETE FROM table_name | |
where column_name in( |
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
UPDATE cities SET city_state = lower(trim(city_state)) |
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
//Demo template | |
/* <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;"> | |
<title>Insert title here</title> | |
</head> | |
<body> | |
<div id="header"> | |
##header## |