Skip to content

Instantly share code, notes, and snippets.

View pingram3541's full-sized avatar

pingram3541 pingram3541

View GitHub Profile
@pingram3541
pingram3541 / field_upload.js
Last active December 6, 2016 18:21
BeTheme Muffin Options - Upload Field - Src Path to Relative URL
function MfnUpload(){
(function($) {
jQuery( 'img[src=""]' ).attr( 'src', mfn_upload.url );
jQuery( '.mfn-opts-upload' ).click( function( event ) {
event.preventDefault();
var activeFileUploadContext = jQuery( this ).parent();
var type = jQuery( 'input', activeFileUploadContext ).attr( 'class' );
/* ---------------------------------------------------------------------------
* Add Specials custom post type
* --------------------------------------------------------------------------- */
function create_specials_cpt(){
register_post_type( 'specials',
// CPT Options
array(
'labels' => array(
'name' => __( 'Specials' ),
'singular_name' => __( 'Special' )
<?php
/**
* Template Name: Specials
*
* @package Betheme
* @author Muffin Group
*/
get_header();
/* ---------------------------------------------------------------------------
* Equeue for Specials Page
* --------------------------------------------------------------------------- */
add_action('wp_enqueue_scripts', 'enqueue_specials_script');
function enqueue_specials_script(){
if(is_archive( 'specials' )){
wp_enqueue_script( 'specials-script', get_stylesheet_directory_uri() .'/js/specials.js', array(), null, true);
}
}
@pingram3541
pingram3541 / field_upload_3_4.js
Created May 23, 2015 18:38
BeTheme Muffin Options - Upload Field - Src Path to Relative URL - older wp
function MfnUpload(){
(function($) {
var header_clicked = false;
var item_clicked = '';
jQuery("img[src='']").attr("src", mfn_upload.url);
jQuery('.mfn-opts-upload').click(function() {
item_clicked = jQuery(this);
jQuery(function($) {
// returns an array of the potential selector components for the first element in the jQuery object. IDs, classes, and tagNames only.
var getSelectorComponents = function($el) {
var components = [];
var id = $el.attr('id');
if (typeof(id)!='undefined' && /[^\s]/.test(id)) {
components.push('#'+id);
}
@pingram3541
pingram3541 / theme-shortcodes.php
Created September 13, 2015 17:14
BeTheme - Google font shortcode - line-height option
/* ---------------------------------------------------------------------------
* Google Font [google_font]
* --------------------------------------------------------------------------- */
if( ! function_exists( 'sc_google_font' ) )
{
function sc_google_font( $attr, $content = null )
{
extract(shortcode_atts(array(
'font' => '',
'size' => '25',
@pingram3541
pingram3541 / functions.php
Created September 25, 2015 18:41
Add Facebook Open Graph Meta Tags
/* ---------------------------------------------------------------------------
* FACEBOOK OPENGRAPH SETTINGS
* ---------------------------------------------------------------------------
* @wp-filter - language_attributes
* @retun - adds og lang tags to doc element
*
* @wp-hook wp_head
* @return - adds og meta tags to pages
* --------------------------------------------------------------------------- */
add_filter('language_attributes', 'tda_doctype_opengraph');
@pingram3541
pingram3541 / class-customize-queried-post-info.php
Created March 6, 2016 23:07 — forked from westonruter/class-customize-queried-post-info.php
Customize Queried Post Info plugin: Communicate the singular post queried object currently previewed in the Customizer.
<?php
/**
* Customize_Queried_Post_Info class.
*
* @package CustomizeQueriedPostInfo
*/
/**
* Class Customize_Queried_Post_Info.
*/
@pingram3541
pingram3541 / wp-dashboard-notes.php
Created April 4, 2016 18:19
wp dashboard notes - all admin access, not just by user id (lines 211-243, modified lines 15 and 18)
/**
* Initialize dashboard notes.
*
* Get all notes and initialize dashboard widgets.
*
* @since 1.0.0
*/
public function wpdn_init_dashboard_widget() {
$notes = $this->wpdn_get_notes();