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 | |
add_action( 'add_meta_boxes', 'adding_new_metaabox' ); | |
function adding_new_metaabox() | |
{ | |
add_meta_box('adsexcerptid', 'Ads Content', 'my_output_function'); | |
} | |
function my_output_function( $post ) | |
{ | |
$settings = array( |
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 my_custom_save_function($post_id){ | |
update_post(array('ID' => $post_id, 'post_excerpt' => $_POST['my_custom_field'])); | |
} | |
add_action('save_post', 'my_custom_save_function'); |
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
var myConfObj = { | |
iframeMouseOver : false | |
} | |
window.addEventListener('blur',function(){ | |
if(myConfObj.iframeMouseOver){ | |
console.log('Wow! Iframe Click!'); | |
} | |
}); | |
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseover',function(){ |
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
# SQL to Use the code as below and swap in your old and new URLs, no trailing slashes. Also if necessary change the table prefix values where applicable (ie wp_ ) | |
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); | |
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 | |
define('MY_POST_TYPE', 'my'); | |
define('MY_POST_SLUG', 'gallery'); | |
function my_register_post_type () { | |
$args = array ( | |
'label' => 'Gallery', | |
'supports' => array( 'title', 'excerpt' ), | |
'register_meta_box_cb' => 'my_meta_box_cb', |
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 | |
/** | |
* Implements hook_video_filter_codec_info_alter(). | |
* Add video filter html5 support for dailymotion. | |
*/ | |
function MY_MODULE_video_filter_codec_info_alter(&$codecs) { | |
if (!isset($codecs['dailymotion']['html5_callback'])) { | |
$codecs['dailymotion']['html5_callback'] = 'MY_MODULE_video_filter_dailymotion_html5'; | |
} | |
} |
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 | |
$url = 'http://www.IrfanAnsari.com/embedviz?q=select+col9+from+1c16ZytvOGsazT5r4borWzDSKmRy1dyeCqzOHdnWb&viz=MAP&h=false&lat=28.098107336734692&lng=68.93999515039059&t=1&z=6&l=col9&y=2&tmplt=2&hml=GEOCODABLE'; | |
function grab_url($url) { | |
if(!empty($url)) { | |
$urllist=parse_url($url); | |
if(is_array($urllist) && isset($urllist["query"])) { | |
$keyvalue_list=explode("&",($urllist["query"])); |
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
Squarifying Bootstrap Spans | |
I just wrote a quick little js plugin to make any element's height equal to it's width. It's not really bootstrap specific, but it's helpful for spans if you need a span to be square at all times, even when the responsive resizing is done. | |
Introducing Squarify... | |
function squarifyMe(element) { | |
squareItUp() | |
window.onresize = function(element) { | |
squareItUp(); | |
} |
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
/** | |
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript | |
* https://gist.github.com/faisalman | |
* | |
* Copyright 2012, Faisalman <fyzlman@gmail.com> | |
* Licensed under The MIT License | |
* http://www.opensource.org/licenses/mit-license | |
*/ | |
(function(){ |
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
/** | |
* Removes "image edit" option from Media Manager. | |
*/ | |
add_action( 'admin_footer-post-new.php', 'wpse_76214_script' ); | |
add_action( 'admin_footer-post.php', 'wpse_76214_script' ); | |
function wpse_76214_script() { | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready( function($) { | |
$( 'li.attachment' ).live( 'click', function( event ) { |