Skip to content

Instantly share code, notes, and snippets.

View anthonysbrown's full-sized avatar

Anthony Brown anthonysbrown

  • Worcester, MA USA
View GitHub Profile
@anthonysbrown
anthonysbrown / functions.php
Created June 16, 2017 12:05
WordPress Limit posts by ip address
add_action('init','wp_limit_post_by_ip');
function wp_limit_post_by_ip(){
global $post;
#posts this is required, comma seperate
$post_ids = array(12);
#array of ips comma seperate
$allowed_ips = array('127.0.0.1');
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
@anthonysbrown
anthonysbrown / functions.php
Created November 3, 2015 15:05
Events Manager Pro - Add attending alert on single event page if attending
<?php
function highlight_attending_single(){
global $post,$current_user;
$attendies = get_post_meta($post->ID, '_eventrocket_attendance', true );
$attending = false;
if(is_array($attendies)){
foreach($attendies as $key=>$value){
if($key == $current_user->ID && $value == 1){
[posts] => Array
(
[0] => WP_Post Object
(
[ID] => 8299
[post_author] => 969
[post_date] => 2017-07-05 11:00:26
[post_date_gmt] => 2017-07-05 01:00:26
[post_content] => 100% Australian Wool seat cover - suits national Highback seats.
@anthonysbrown
anthonysbrown / obit-bob-marley.php
Created September 19, 2017 17:29
Create a new template in your themes /wp-funeral-press/ directory
<?php
global $obit_vars,$wpfh_user_obits;
extract($obit_vars);
?>
<div style="margin:20px 0px;background-color:#E8FEDA;padding:15px">
<h1>You can override templates in your theme folder! This is a custom template!</h1>
<p>Overriding templates can be a great upsell tool, you can design specific layouts colors and add your own html to a custom template. Another great feature here is to let the deceased family choose from a bunch of different color/layouts you created! Check out the below Bob Marley themed template!</p>
</div>
<style type="text/css">
@anthonysbrown
anthonysbrown / functions.php
Last active November 27, 2017 14:08
functions.php
add_action('spcdm/files/responsive/before', 'custom_cdm_add_file_id');
function custom_cdm_add_file_id($file_id){
echo '#'.$file_id.' ';
}
@anthonysbrown
anthonysbrown / functions.php
Last active November 29, 2017 19:11
hook into cdm after file upload
add_action('sp_cdm_after_file_upload','custom_cdm_after_file_upload',10,2);
function custom_cdm_after_file_upload($target_path,$uid){
$pass = true;
#do some validation
if($somethignisntright){
$pass = false;
4.9791122715405 Average rating our of 383 Reviews
Array ( [0] => 5 [1] => 5 [2] => 5 [3] => 5 [4] => 5 [5] => 5 [6] => 5 [7] => 5 [8] => 5 [9] => 5 [10] => 5 [11] => 5 [12] => 5 [13] => 5 [14] => 5 [15] => 5 [16] => 5 [17] => 5 [18] => 5 [19] => 5 [20] => 5 [21] => 5 [22] => 5 [23] => 5 [24] => 5 [25] => 5 [26] => 5 [27] => 5 [28] => 5 [29] => 5 [30] => 5 [31] => 5 [32] => 5 [33] => 5 [34] => 5 [35] => 5 [36] => 5 [37] => 5 [38] => 5 [39] => 5 [40] => 5 [41] => 5 [42] => 5 [43] => 5 [44] => 5 [45] => 5 [46] => 5 [47] => 5 [48] => 5 [49] => 5 [50] => 5 [51] => 5 [52] => 5 [53] => 5 [54] => 5 [55] => 5 [56] => 5 [57] => 5 [58] => 5 [59] => 5 [60] => 5 [61] => 5 [62] => 5 [63] => 5 [64] => 5 [65] => 5 [66] => 5 [67] => 5 [68] => 5 [69] => 5 [70] => 5 [71] => 5 [72] => 5 [73] => 5 [74] => 5 [75] => 5 [76] => 5 [77] => 5 [78] => 5 [79] => 5 [80] => 5 [81] => 5 [82] => 5 [83] => 5 [84] => 5 [85] => 5 [86] => 5 [87] => 5 [88] => 5 [89] => 5 [90] => 5 [91] => 5 [92] => 5 [93] => 5 [94] => 5 [95] => 5 [96] => 5 [97] =
@anthonysbrown
anthonysbrown / search.php
Last active January 12, 2018 16:53
Get an excerpt for the visual editor in Enfold. Normally it's blank but this pulls the meta data for the content.
<?php
echo '<div class="entry-content" '.avia_markup_helper(array('context' => 'entry_content','echo'=>false)).'>';
$excerpt = trim(get_the_excerpt());
if(!empty($excerpt))
{
the_excerpt();
}
else
{
[player] => Array
(
[player_id] => 92
[player_email] =>
[name] => Alex Lawrie
[position] => QB
[height] => 5'11
[weight] => 190
[hometown] => Ottawa
[class] => 2017
Array
(
[player] => Array
(
[player_id] => 42
[player_email] =>
[name] => Ahmad Imtiaz
[position] => LB
[height] => 6'0
[weight] => 220