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 | |
/** | |
* File Name: create-posts.php | |
* @package WordPress | |
* @subpackage ParentTheme_VC | |
* @license GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | |
* @version 0.3 | |
* @updated: 06.28.12 | |
* | |
* Description: |
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 | |
/************* ADDING CLASSES TO POST_CLASS **************/ | |
// every post has a few uniquely colored elements, rather than rely on CSS nth-magic, and to keep things smooth | |
// and not conflict w/ trying to use jQuery nth-magic in tandem w/ the endless scroll, | |
// the option is to get the server to do the heavy lifting, | |
// ideally it would be nice to pass the array of classes to iterate thru into the filter, | |
/** | |
* | |
* @param $classes |
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: Oembed as Post Meta | |
Author: Randy Hicks | |
Plugin URI: http://visualcoma.com | |
Author URI: http://visualcoma.com | |
Version: 0.2 | |
Updated: 09.29.12 | |
Description: Adds a custom metabox to specified post_types allowing for youtube and vimeo oembed | |
to be saved as hidden postmeta. Returns visalbe video url and video thumbnail. |
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 | |
require_once( ABSPATH . WPINC . '/class-oembed.php' ); | |
$WP_oEmbed = new WP_oEmbed(); | |
$provider = $WP_oEmbed->discover( $url ); | |
$data = $WP_oEmbed->fetch( $provider, $url ); | |
if ( isset( $data ) AND $data != false ) { print_r($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
/** | |
* Has Children | |
**/ | |
function has_children( $post_id, $post_type ) { | |
global $wpdb; | |
$querystr = "SELECT $wpdb->posts.ID FROM $wpdb->posts WHERE $wpdb->posts.post_type = '$post_type' AND $wpdb->posts.post_parent = '$post_id' LIMIT 1"; | |
$results = $wpdb->get_results( $querystr, ARRAY_N ); |
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 | |
$state_list = array( | |
'AL'=>"Alabama", | |
'AK'=>"Alaska", | |
'AZ'=>"Arizona", | |
'AR'=>"Arkansas", | |
'CA'=>"California", | |
'CO'=>"Colorado", | |
'CT'=>"Connecticut", | |
'DE'=>"Delaware", |
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 | |
$array_of_data = array('Array','Of','Data'); | |
/** | |
* meta_query WP_Query | |
**/ | |
$query = array( | |
'post_type' => 'custom_post_type', |
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
/** | |
* Get User Id from meta_key, meta_value | |
**/ | |
function get_user_id_by_meta( $meta_key, $meta_value ) { | |
global $wpdb; | |
$querystr = "SELECT $wpdb->usermeta.user_id FROM $wpdb->usermeta WHERE $wpdb->usermeta.meta_key = '$meta_key' AND $wpdb->usermeta.meta_value = '$meta_value'"; | |
$results = $wpdb->get_results( $querystr, ARRAY_N ); | |
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
/** | |
* Build Query URL | |
**/ | |
function build_query_url( $params, $request_type ) { | |
// Add an expire time of 15 minutes unless otherwise specified | |
if ( is_array( $params ) AND !array_key_exists( 'expires', $params ) ) | |
$params['expires'] = time() + 900; | |