This file contains hidden or 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 intw_autoset_featuredimage() { | |
global $post; | |
$already_has_thumb = has_post_thumbnail($post->ID); | |
if (!$already_has_thumb) { | |
$attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" ); | |
if ($attached_image) { | |
foreach ($attached_image as $attachment_id => $attachment) { | |
set_post_thumbnail($post->ID, $attachment_id); |
This file contains hidden or 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 | |
// WordPress function that encodes an email address (and adds mailto: link) | |
echo antispambot('[email protected]', 1); | |
?> | |
<?php | |
// Shortcode to encode email address in a mailto: link | |
function protect_email_address( $atts , $content=null ) { | |
for ($i = 0; $i < strlen($content); $i++) $encodedmail .= "&#" . ord($content[$i]) . ';'; |
This file contains hidden or 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 intw_head() { | |
if ( !current_user_can('administrator') ) { ?> | |
<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); | |
_gaq.push(['_setDomainName', 'example.com']); | |
_gaq.push(['_trackPageview']); | |
(function() { |
This file contains hidden or 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 intw_gf_sublabels() { | |
if( is_page(39) ) { ?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function() { | |
jQuery('.ginput_complex label').each(function(i,e){ | |
sublabel = jQuery('<label>').append(jQuery(e).clone()).remove().html(); | |
jQuery(e).siblings().after(sublabel); | |
jQuery(e).remove(); |
This file contains hidden or 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 | |
class Intw_User_Caps { | |
// Add our filters | |
function Intw_User_Caps(){ | |
add_filter( 'editable_roles', array(&$this, 'editable_roles')); | |
add_filter( 'map_meta_cap', array(&$this, 'map_meta_cap'),10,4); | |
} |
This file contains hidden or 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 | |
// This function will return true if we are looking at the page in question or one of its sub pages | |
function is_tree( $pid ) { // $pid = The ID of the page we're looking for pages underneath | |
global $post; // load details about this page | |
if ( is_page($pid) ) | |
return TRUE; // we're at the page or at a sub page | |
$anc = get_post_ancestors( $post->ID ); |
This file contains hidden or 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 | |
// Modify default widget wrappers | |
add_filter( 'builder_filter_register_sidebar_options', 'intw_modify_widget_wrappers' ); | |
function intw_modify_widget_wrappers( $options ) { | |
$options['before_title'] = '<div class="widget-title">'; | |
$options['after_title'] = '</div>'; | |
return $options; | |
} | |
?> |
This file contains hidden or 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 | |
// Hook right after opening <body> tag | |
add_action('builder_layout_engine_render_header', 'intw_add_after_opening_body', 20 ); | |
function intw_add_after_opening_body() { ?> | |
HTML code that you want just after the opening body tag should be placed here | |
<?php } | |
// Hook right before closing </body> tag | |
add_action('builder_finish', 'intw_add_before_closing_body', 0 ); | |
function intw_add_before_closing_body() { ?> |