Skip to content

Instantly share code, notes, and snippets.

View joshmoto's full-sized avatar

J O S H M O T O joshmoto

View GitHub Profile
<?php if ( !is_singular(array('exhibitor', 'features', 'zones'))) {
$currentID = get_the_ID();
$exhibitorMeta = new WP_Query(array(
'post_type' => 'exhibitor',
'post_id' => $currentID ,
'meta_query' => array(
'relation' => 'OR',
@joshmoto
joshmoto / functions.php
Created August 13, 2012 17:24
Search not working...
// SEARCH FORM HEADER
function search_form_header( $form ) {
$form = '<form method="get" id="header-searchform" action="' . home_url( '/' ) . '" >
<div>
<div class="searchform-left"></div>
<input class="searchform-mid clearit" type="text" name="search" id="search-header" value="Search" />
<div class="searchform-right"></div>
</div>
</form>';
return $form;
@joshmoto
joshmoto / dealer-results.php
Last active December 11, 2015 14:09
This is my php file which will load in via ajax when my form is submitted...
<?php
define('WP_USE_THEMES', false);
require ('/home/sites/mysite.co.uk/www/wp/wp-load.php');
$ajaxCounty = $_GET['varCounty'];
$ajaxTown = $_GET['varTown'];
$dealerResults = new WP_Query(array(
<!-- THE SCRIPT -->
<?php echo do_shortcode('[gravityform id="3" name="Competition Entry" ajax="true"]'); ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
var countryClass = '.dealer-country',
@joshmoto
joshmoto / gist:4690927
Created February 1, 2013 12:02
help.php
<?php
define('WP_USE_THEMES', false);
require('/home/sites/mission-rossi.com/www/wp/wp-load.php');
?>
<!DOCTYPE html>
<html>
@joshmoto
joshmoto / gist:4690958
Created February 1, 2013 12:11
functions.php
<?php
function dealer_search_fn(){
check_ajax_referer( 'dealer_search', 'nonce' );
$ajaxCounty = $_POST['varCounty'];
$ajaxTown = $_POST['varTown'];
$dealerResults = new WP_Query(array(
'post_type' => 'dealer',
@joshmoto
joshmoto / gist:4771584
Last active December 12, 2015 12:19
user profile meta tick boxes layout
<h3>Network Access Privileges</h3>
<table class="form-table">
<tbody>
<tr>
<th scope="row">My Site Title</th>
<td>
<label for="comment_shortcuts">
<input type="checkbox" name="" id="" value="true">
@joshmoto
joshmoto / duplicate_image_removal.html
Created February 12, 2013 21:15
duplicate image removal
<div id="submitdiv" class="postbox ">
<div class="handlediv" title="Click to toggle"><br></div>
<h3 class="hndle"><span>Remove Dupicate Images</span></h3>
<div class="inside">
<div class="submitbox" id="submitpost">
/* showing duplicated box */
function print_duplicated_image_box( $post ) {
wp_nonce_field( 'remove_duplicated_nonce_action', 'remove_duplicated_nonce' ); ?>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#scan-images-duplicated, #delete-images-duplicated').click(function(e){
e.preventDefault();
var order = $(this).hasClass('scanimages') ? 'scan' : 'delete_all',
p_data = {
action: 'galleryduplicate',
@joshmoto
joshmoto / functions.php
Created February 13, 2013 16:32
functions.php
// SEND EMAIL WHAT SHOW ON CUSTOM BOX
function print_my_custom_notification_box( $post ) {
wp_nonce_field( 'my_custom_notification_box_nonce_action', 'my_custom_notification_box_nonce_field' ); ?>
<script type="text/javascript">
jquery(document).ready(function($){
$('#mynotification-box-button').click(function(e){
e.preventDefault();
$('#mynotification-box .spinner').show();
$.ajax({ url: ajaxurl, data: { action: 'sendnotification', postID: $('#post_ID').val(), my_notification_nonce: $('#my_custom_notification_box_nonce_field').val() },