Skip to content

Instantly share code, notes, and snippets.

View jfeliweb's full-sized avatar
🖖
Love, Peace and Happiness

Jean Felisme jfeliweb

🖖
Love, Peace and Happiness
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
(function() {
function handlePageLoad() {
var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
document.getElementById('prechatForm').setAttribute('action',
decodeURIComponent(endpointMatcher.exec(document.location.search)[1]));
}
@jfeliweb
jfeliweb / gist:6b8548db701a07d075a6
Created August 13, 2014 21:43
Creating a Widget Area
<!-- Registering a Widget Area - in funuction.php -->
/**
* Register Widget Area.
*
*/
function jenesis_widgets_init() {
register_sidebar( array(
'name' => 'Header Sidebar',
<?php
/*
Adding First and Last Name to Checkout Form
*/
//add the fields to the form
function my_pmpro_checkout_after_password()
{
if(!empty($_REQUEST['firstname']))
$firstname = $_REQUEST['firstname'];
<?php
/*
Plugin Name: PMPro Address For Free Levels
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-address-for-free-levels/
Description: Show address fields for free levels also with Paid Memberships Pro
Version: .2
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@jfeliweb
jfeliweb / Numbered Page Navigation
Created October 10, 2014 21:45
Numbered Page Navigation
<!-- Paging Start -->
<div class="paging">
<ul>
<?php
global $wp_query;
$big = 999999999; // need an unlikely integer
$args = array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?page=%#%',
'total' => $wp_query->max_num_pages,
@jfeliweb
jfeliweb / Create Multiple Search Functions for Everything
Created October 10, 2014 22:02
Create multiple Search functions for posts & custom post types and everything
/* Search Everything*/
function SearchFilter($query) {
$post_type = $_GET['post_type'];
if (!$post_type) {
$post_type = 'any';
}
if ($query->is_search) {
$query->set('post_type', $post_type);
};
return $query;
@jfeliweb
jfeliweb / Excerpt Length
Created October 16, 2014 17:21
Controlling Excerpt Length Using Filters
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
@jfeliweb
jfeliweb / Content Length Using A Custom Function
Created October 16, 2014 17:24
Controlling Content Length Using A Custom Function
/*************************************************************************
The following function takes two parameters:
$string – The string that needs be limited for example get_the_excerpt().
$max_words – The maximum amount of words you would like to show.
***************************************************************************/
/* Limit Your Website Excerpt */
function word_limit($string, $max_words){
@jfeliweb
jfeliweb / Removing WordPress Version Number
Created October 16, 2014 17:26
Removing WordPress Version Number
remove_action('wp_head', 'wp_generator');
@jfeliweb
jfeliweb / Can't Touch This Author
Created October 16, 2014 17:28
Restrict Authors to Edit Only Their Own Posts and Media
/* Only See Own Attachments */
add_action('pre_get_posts','users_attachments');
function users_attachments( $wp_query_obj ) {
global $current_user, $pagenow;
if( !is_a( $current_user, 'WP_User') )
return;