Skip to content

Instantly share code, notes, and snippets.

View danstramer's full-sized avatar

Dan Stramer danstramer

View GitHub Profile
@danstramer
danstramer / gist:0007bf066b108d527e9dff0d78c1155c
Created July 5, 2018 15:33
Redirect a user if he is not logged in
<?php if(!is_user_logged_in()){wp_redirect( 'http://www.yourwebsite.com/_index.html' ); exit;}?>
@danstramer
danstramer / gist:6a22b0b4feb66d5787b05efe7e77c6c2
Created June 26, 2018 14:54
Create s shortcode button with attributes
//https://www.wpexplorer.com/wordpress-button-shortcode/
//[button url="YOUR LINK" target="self" color="blue"]Button Text[/button]
//[button url="YOUR LINK" target="self" text="Button Text"]
function myprefix_button_shortcode( $atts, $content = null ) {
// Extract shortcode attributes
extract( shortcode_atts( array(
'url' => '',
'title' => '',
'target' => '',
add_filter('excerpt_length', 'my_excerpt_length');
function my_excerpt_length($length) {
if(is_front_page()) {
return 9;
} else {
return 40;
}
}