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 | |
function add_embed_tweet_meta_box() { | |
add_meta_box( | |
'paulund_embed_tweet_meta_box', // $id | |
'Post Embed Tweets Meta Box', // $title | |
'show_embed_tweet_meta_box', // $callback | |
'post', // $page | |
'normal', // $context | |
'high'); // $priority | |
} |
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
define('WP_HOME','http://domain.com/wordpress'); | |
define('WP_SITEURL','http://domain.com/wordpress'); |
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 | |
/* Remove WordPress generator meta tag */ | |
remove_action('wp_head', 'wp_generator'); |
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 | |
find_replace_custom_field_data( $post_ID = NULL, $custom_field_name = NULL, $search_for = NULL, $replace_with = NULL ) { | |
if ( isset( $post_ID ) && isset( $custom_field_name ) ) | |
$get_ custom_field = get_post_meta( $post_ID, $custom_field_name, TRUE ); | |
$custom_field_new = str_replace( $search_for, $replace_with, custom_field ); | |
set_post_meta( $post_ID, $custom_field_new );` | |
} | |
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 | |
/* | |
Plugin Name: City Events | |
Plugin URI: http://JohnBocook.com | |
Description: Registers a Custom Post Type for Events and create's a metabox for event time. | |
Version: 1.0 | |
Author: John Bocook | |
Author URI: http://johnbocook.com | |
License: Public Domain | |
*/ |
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 | |
//change these settings | |
$dbhost = ""; | |
$dbusername = "": | |
$dbpassword = "": | |
$dbname = ""; | |
$dbtable = ""; | |
//connect to database and grab the data |
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 | |
// | |
$con = mysql_connect("localhost","username","password"); | |
if (!$con) | |
{ | |
die('Could not connect: ' . mysql_error()); | |
} | |
mysql_select_db("my_db", $con); |
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 $json = file_get_contents('http://api.facebook.com/method/fql.query?format=json&query=select+fan_count+from+page+where+page_id%3D475488679182886'); | |
$decode = json_decode($json); | |
echo $decode[0]; // Fan Count | |
?> |
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 | |
if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 1800)) { | |
// last request was more than 30 minutes ago | |
session_unset(); // unset $_SESSION variable for the run-time | |
session_destroy(); // destroy session data in storage | |
} | |
$_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp | |
/* | |
You can also use an additional time stamp to regenerate the session ID periodically to avoid attacks on sessions like session fixation: |
OlderNewer