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
Template.CommentAdd.events({ | |
'submit form': function(e, tmpl) { | |
e.preventDefault(); | |
formEl = tmpl.find('form'); | |
comment = tmpl.find('[name=comment]').value; | |
if (comment.trim().length == 0) { return false; }; | |
Comments.insert({ | |
login: Meteor.user().profile.login, | |
timestamp: new Date, | |
room: Session.get('activeRoom'), |
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 | |
/* | |
Do Shortcode | |
http://codex.wordpress.org/Function_Reference/do_shortcode | |
StackOverflow - Better Way to Explode String | |
http://stackoverflow.com/questions/7355301/a-better-way-to-explode-twice-in-php | |
*/ |
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
add_filter( 'contextual_help', 'wptuts_contextual_help', 10, 3 ); | |
function wptuts_contextual_help( $contextual_help, $screen_id, $screen ) { | |
// Only add to certain screen(s). The add_help_tab function for screen was introduced in WordPress 3.3. | |
if ( $screen_id == 'market-trends' || ! method_exists( $screen, 'add_help_tab' ) ) | |
return $contextual_help; | |
$screen->add_help_tab( array( | |
'id' => 'wptuts-overview-tab', |
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
<div class="input-group col-sm-6"> | |
[text* cf-name class:form-control placeholder "Name"] | |
<span class="input-group-addon"><i class="fa fa-user"></i></span> | |
</div> | |
<div class="input-group col-sm-6"> | |
[text* cf-business class:form-control placeholder "Business Name"] | |
<span class="input-group-addon"><i class="fa fa-building"></i></span> | |
</div> |
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 | |
/************************************************ | |
Mail Chimp Integration with Wordpress Contact Form 7 | |
************************************************/ | |
function wpcf7_send_to_mailchimp($cfdata) { |
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
function render_post_array ($group = 'location', $key = 'postal') { | |
if ($_POST['location'] && is_array($_POST['location']['postal'])) { | |
$output = ''; | |
foreach ($_POST[$group][$key] as $value) { | |
$output .= '<input type="hidden" name="'.$group.'['.$key.'][]" value="' . $value .'" >'; | |
} | |
$output .= '<input type="hidden" name="'.$group.'['.$key.'][]" value="in" >'; | |
} | |
return $output; | |
} |
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
function is_blog () { | |
global $post; | |
$posttype = get_post_type($post ); | |
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ; | |
} | |
Usage: | |
<?php if (is_blog()) { echo 'You are on a blog page'; } ?> |
NewerOlder