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
//INSERT DATA | |
$data = array('title'=>'hello there','content'=>'how are you? i am fine over here.','status'=>1); | |
$model = Mage::getModel('mynews/mynews')->setData($data); | |
try { | |
$insertId = $model->save()->getId(); | |
echo "Data successfully inserted. Insert ID: ".$insertId; | |
} catch (Exception $e){ | |
echo $e->getMessage(); | |
} |
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
Using Git | |
=============== | |
Global Settings | |
----------- | |
Related Setup: https://gist.github.com/hofmannsven/6814278 | |
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/ |
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
<?php | |
class sm_project { | |
function sm_project() { | |
add_action('init',array($this,'create_post_type')); | |
add_action('init',array($this,'create_taxonomies')); | |
add_action('manage_sm_project_posts_columns',array($this,'columns'),10,2); | |
add_action('manage_sm_project_posts_custom_column',array($this,'column_data'),11,2); | |
add_filter('posts_join',array($this,'join'),10,1); | |
add_filter('posts_orderby',array($this,'set_default_sort'),20,2); |
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
<?php | |
$user_id = 1; # Insert your user ID or simply 1 for the first user that was created | |
$user_pass = 'secret'; # Insert a new password | |
$ip = '127.0.0.1'; # Insert your IP | |
if ($_SERVER['REMOTE_ADDR'] === $ip) { | |
require_once(ABSPATH . WPINC . '/registration.php'); | |
require_once(ABSPATH . WPINC . '/pluggable.php'); | |
$user = wp_update_user(array( | |
'ID' => $user_id, |
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
add_action('post_submitbox_misc_actions', 'send_to_user_block'); | |
function send_to_user_block() | |
{ | |
global $pagenow; | |
$post_id = get_the_ID(); | |
if (get_post_type($post_id) != 'post') { | |
return; | |
} |
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
#!/bin/bash | |
dir="$1" | |
# No directory has been provided, use current | |
if [ -z "$dir" ] | |
then | |
dir="`pwd`" | |
fi |
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
#!/bin/bash | |
dir="$1" | |
# No directory has been provided, use current | |
if [ -z "$dir" ] | |
then | |
dir="`pwd`" | |
fi |
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
Method 1: | |
--------- | |
If you are executing PHP directly from the Cron Job e.g. php /path/to/your_script.php then add the following line at the top of your PHP script: | |
if (php_sapi_name() !='cli') exit; | |
Method 2: | |
--------- | |
if the Cron Job uses wget, curl or lynx to run your script via its URL, then insert this code at the top of your PHP script (change the User Agent string to one known only by you) : |
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
##################### ElasticSearch Configuration Example ##################### | |
# This file contains an overview of various configuration settings, | |
# targeted at operations staff. Application developers should | |
# consult the guide at <http://elasticsearch.org/guide>. | |
# | |
# The installation procedure is covered at | |
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>. | |
# | |
# ElasticSearch comes with reasonable defaults for most settings, |
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 create_update_delete_index($arr_input) { | |
$options = get_option('post_types'); | |
foreach($this->post_types as $key => $value){ | |
$options[$key] = (isset($arr_input[$key]) && !empty($arr_input[$key])) ? 1: 0; | |
$index_params = array(); | |
$index_names = array(); | |
$index_names = array('index' => $key); | |
$index_params = array('index' => $key, |