View gist:6563430
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 | |
// FILTER POST CONTENT - SHOWS FIRST N PARAGRAPHS | |
function filter_content_n_paragraphs( $content ) { | |
$stopat = 2; // how many paragraphs you want to display (n) | |
$paragraphno = $stopat - 1; // computers start at 0 | |
// conditions to meet for filtering content | |
if( !is_user_logged_in() ) { |
View gist:6563864
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 set_email_to_pardot_cookie() { | |
setcookie( 'email-to-pardot', 1, strtotime( '+30000 days' ), COOKIEPATH, COOKIE_DOMAIN, false ); | |
} | |
add_action( 'gform_after_submission_1', 'set_email_to_pardot_cookie' ); |
View gist:6563869
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 | |
// FILTER POST CONTENT FOR PARDOT | |
function filter_post_content_pardot($content) { | |
if( get_post_meta( get_the_ID(), 'pardot_protected', true ) == 'protected' && !is_user_logged_in() && !isset( $_COOKIE['email-to-pardot'] ) ) { | |
return gravity_form(1, false, false, false) . '<p>This article is only available to subscribers to our newsletter. You may subscribe using the form above.</p>'; | |
} | |
else { | |
return $content; |
View gist:6563876
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 chain_select_shortcode( $atts ) { | |
extract( shortcode_atts( array( 'tax' => 'category', 'level' => 1, 'titles' => array( 'Please select…' ), 'labels' => '', 'btn_text' => 'Submit', 'exclude' => '', 'count' => 1 ), $atts ) ); | |
return chainselect_getcategories( $tax, $level, explode( ', ', $titles ), explode( ', ', $labels ), $btn_text, $exclude, $count ); | |
} | |
add_shortcode( 'ajax_chain_select', 'chain_select_shortcode' ); |
View gist:6565712
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
<!-- Load time: <?php timer_stop( 1, 3 ); ?> seconds to this point. --> |
View gist:6565728
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 set_form_1_complete_cookie() { | |
setcookie( 'form-1-complete', 1, strtotime( '+30 days' ), COOKIEPATH, COOKIE_DOMAIN, false, false ); | |
} | |
add_action( 'gform_after_submission_1', 'set_form_1_complete_cookie' ); |
View gist:6565735
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 restrict_post_content_form_1($content) { | |
if( get_post_meta( get_the_ID(), 'protected', true ) == 'yes' && !is_user_logged_in() && !isset( $_COOKIE['form-1-complete'] ) ) { | |
return gravity_form(1, false, false, false) . '<p>This article is only available to subscribers to our newsletter. You may subscribe using the form above.</p>'; | |
} | |
else { | |
return $content; | |
} | |
} |
View gist:6565740
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 | |
// LOGOUT LINK IN MENU | |
function diww_menu_logout_link( $nav, $args ) { | |
$logoutlink = '<li><a href="'.wp_logout_url().'">Logout</a></li>'; | |
if( $args->menu->term_id == '5' ) { | |
return $nav.$logoutlink ; | |
} else { | |
return $nav; |
View gist:6565746
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 | |
// LOGOUT LINK IN MENU | |
function diww_menu_logout_link( $nav, $args ) { | |
$logoutlink = '<li><a href="'.wp_logout_url().'">Logout</a></li>'; | |
if( $args->theme_location == 'primary' ) { | |
return $nav.$logoutlink ; | |
} else { | |
return $nav; |
View gist:6565757
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 | |
$logoutlink = '<li><a href="'.wp_logout_url( home_url() ).'">Logout</a></li>'; // redirect to home page | |
$logoutlink = '<li><a href="'.wp_logout_url( get_permalink() ).'">Logout</a></li>'; // stay on same page | |
$logoutlink = '<li><a href="'.wp_logout_url( 'http://www.doitwithwp.com/about/' ).'">Logout</a></li>'; // go to specific URL |
OlderNewer