Skip to content

Instantly share code, notes, and snippets.

View Kenshino's full-sized avatar

Jon Ang Kenshino

View GitHub Profile
/*FUNCTION CODE HERE */
function get_top_parent_page_id() {
global $post;
// Check if page is a child page (any level)
if ($post->ancestors) {
// Grab the ID of top-level page from the tree
return end($post->ancestors);
pronamicMedia = function(elem, options) {
this.elem = elem;
this.$elem = jQuery(elem);
this.options = options;
};
pronamicMedia.prototype = {
_frame:undefined
<p>
<label for="resume_custom_attachment_cv"><?php _e( "Upload Resume", 'wingz_resume' ); ?></label>
<input id="resume_custom_attachment_cv" name="resume_custom_attachment_cv" value="" size="25" type="file">
<?php
$img = get_post_meta($object->ID, 'resume_custom_attachment', true);
//check for old post meta name, for backwards compatibility
if ($img == '' || $img == null){
$img = get_post_meta($object->ID, 'resume_custom_attachment_cv', true);
}
//Make up your own query var line
<?php $link_query_args = '?job_industry=' . $industry . '&job_function=' . $job_function . '&location=' . $location . '&job_seniority_level=' . $level . '&search_term=' . $search_term; ?>
<?php if(get_next_posts_link()): ?>
<div class="next_page">
<?php echo wingz_get_next_posts_link('&laquo; Next Page', '', $link_query_args); ?>
</div>
<?php endif; ?>
<?php if(get_previous_posts_link()): ?>
function wingz_get_next_posts_link( $label = null, $max_page = 0, $query_args = null ) {
global $paged, $wp_query;
if ( !$max_page )
$max_page = $wp_query->max_num_pages;
if ( !$paged )
$paged = 1;
$nextpage = intval($paged) + 1;
add_action('gform_after_submission', 'gform_synchronise_media_library', 10, 2);
function gform_synchronise_media_library($entry, $form) {
if(!function_exists('wp_generate_attachment_metadata')){require_once(ABSPATH . 'wp-admin/includes/image.php');}
$post_id = $entry['post_id'];
$fileupload_fields = GFCommon::get_fields_by_type($form, array("fileupload"));
foreach($fileupload_fields as $field){
$field_id = $field["id"];
$file_url = $entry["$field_id"];
if (isset($_FILES['input_' .$field_id]) && $file_url != '' && $file_url !=null){
/*-----------------------------------------------------------------------------------*/
/* Media Library Permissions */
/*-----------------------------------------------------------------------------------*/
add_action('pre_get_posts','users_own_attachments');
function users_own_attachments( $wp_query_obj )
{
global $current_user, $pagenow;
<?php
// domain.com/videos/funny/cute-dogs/
function add_video_post_type() {
$labels = array(
'name' => _x( 'Videos', 'Post Type General Name', 'kibble' ),
'singular_name' => _x( 'Video', 'Post Type Singular Name', 'kibble' ),
'menu_name' => __( 'Videos', 'kibble' ),
<?php
/**
* Class My_Shortcode
*/
class My_Shortcode {
/**
* The shortcode attributes
*
jQuery(document).ready(function ($) {
// Set the original handler, since we override Core, we need to fall back to core if we're not doing stuff our selves
var _custom_media = true,
_orig_wp_media_insert = wp.media.editor.insert;
// Any input field wit hthe class 'theme_custom_media' will trigger our custom behavior
$(".theme_custom_media").click(function (e) {
var button = $(this);
var id = button.attr('id').replace('_button', '');