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
/* | |
* Whitelist email domains from your WPForms. | |
* | |
* @link https://wpforms.com/developers/how-to-restrict-email-domains/ | |
* | |
*/ | |
function wpf_whitelist_domains( $field_id, $field_submit, $form_data ) { | |
$domain = substr( strrchr( $field_submit, "@" ), 1 ); | |
$whitelist = array( 'icloud.com', 'me.com' ); | |
if( ! in_array( $domain, $whitelist ) ) { |
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 wpf_blacklist_domains( $field_id, $field_submit, $form_data ) { | |
$domain = substr( strrchr( $field_submit, "@" ), 1 ); | |
$blacklist = array( 'yahoo.com', 'hotmail.com' ); | |
if( in_array( $domain, $blacklist ) ) { | |
wpforms()->process->errors[ $form_data['id'] ][ $field_id ] = esc_html__( 'We apologize for any inconvenience, we are unable to accept emails from this domain.', 'wpforms' ); | |
return; | |
} | |
} | |
add_action('wpforms_process_validate_email', 'wpf_blacklist_domains', 10, 3 ); |
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
// Disabled wordpress admin bar to all non admininstrators or editors - Jane James | |
function disable_admin_bar() { | |
if (current_user_can('administrator') || current_user_can('editor') ) { | |
// user can view admin bar | |
show_admin_bar(true); // this line isn't essentially needed by default... | |
} else { | |
// hide admin bar | |
show_admin_bar(false); | |
} |
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 | |
/* | |
Name: WordPress Post Like System | |
Description: A simple and efficient post like system for WordPress. | |
Version: 0.5.2 | |
Author: Jon Masterson | |
Author URI: http://jonmasterson.com/ | |
License: | |
Copyright (C) 2015 Jon Masterson |
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( $ ) { | |
'use strict'; | |
$(document).on('click', '.sl-button', function() { | |
var button = $(this); | |
var post_id = button.attr('data-post-id'); | |
var security = button.attr('data-nonce'); | |
var iscomment = button.attr('data-iscomment'); | |
var allbuttons; | |
if ( iscomment === '1' ) { /* Comments can have same id */ | |
allbuttons = $('.sl-comment-button-'+post_id); |
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 | |
/** | |
Template Name: Vendor Event Template | |
Template Post Type: event | |
*/ | |
get_header(); | |
?> | |
<div id="primary" class="content-area bb-grid-cell"> | |
<main id="main" class="site-main"> |
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 | |
/* | |
Template Name: Custom Event Template | |
Template Post Type: event | |
*/ |
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 | |
/** | |
* The template for displaying the Event Index | |
* | |
* @package PSN WordPress Theme | |
* @version 1.0 | |
*/ | |
// Exit if accessed directly. |
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
1. // use the page url and append the CPT template file you would like to redirect canoncial URL's | |
add_action( 'template_redirect', 'insight_template_redirect', 1 ); | |
function insight_template_redirect() { | |
if ( is_paged() && is_single( 'yourwebsite.com/category' ) ) { | |
remove_action( 'template_redirect', 'redirect_canonical' ); | |
} | |
} | |
2. // Declare pagination function and use paged parameter in wp_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
// for practical purposes I have called this template archive-template | |
but if your custom post type category is moves you would call this archive-movies.php. | |
I have set the posts to 9, but you can set it to however many you want. | |
$paged = ( get_query_var('paged')) ? get_query_var('paged') : 1; | |
$args = array( | |
'post_type' => 'insight', | |
'post_status' => 'publish', | |
'posts_per_page' => 9, |
OlderNewer