Skip to content

Instantly share code, notes, and snippets.

@wpdew
wpdew / functions.php
Created May 13, 2022 13:39
Get Current User's IP
<?php
/**
* Get Ip function
*/
function get_current_user_ip() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) :
$ip = $_SERVER['HTTP_CLIENT_IP'];
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) :
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
@wpdew
wpdew / fild.php
Created May 13, 2022 06:07
wow.js + animate.css to implement loading element animation on page scroll - ACF example
array(
'key' => 'field_61f97e8e47295',
'label' => 'Animation',
'name' => 'animation',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
@wpdew
wpdew / functions.php
Created May 13, 2022 05:33
User Registration Front End WordPress with Ajax
<?php
add_action('wp_ajax_register_user_front_end', 'register_user_front_end', 0);
add_action('wp_ajax_nopriv_register_user_front_end', 'register_user_front_end');
function register_user_front_end() {
$new_user_name = stripcslashes($_POST['new_user_name']);
$new_user_email = stripcslashes($_POST['new_user_email']);
$new_user_password = $_POST['new_user_password'];
$user_nice_name = strtolower($_POST['new_user_email']);
$user_data = array(
'user_login' => $new_user_name,
@wpdew
wpdew / Add user menu bubble feedback for custom post (feedback)
Last active May 12, 2022 19:03
Add user menu bubble feedback for custom post (feedback)
//add_user_menu_bubble_feedback
add_action( 'admin_menu', 'add_user_menu_bubble_feedback' );
function add_user_menu_bubble_feedback(){
global $menu;
$count = wp_count_posts('feedback')->draft;
if( $count ){
foreach( $menu as $key => $value ){
if( $menu[$key][2] == 'edit.php?post_type=feedback' ){
$menu[$key][0] .= ' <span class="awaiting-mod"><span class="pending-count">' . $count . '</span></span>';
break;
@wpdew
wpdew / README-Template.md
Created March 6, 2018 23:47 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites