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 | |
function myplugin_ajax_job_search() { | |
/* get the search terms entered into the search box */ | |
$search = sanitize_text_field( $_POST[ 'search' ] ); | |
/* run a new query including the search string */ | |
$q = new WP_Query( | |
array( | |
'post_type' => job_post_type_name, |
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 | |
function myplugin_enqueue_scripts() { | |
/* hand the js for deleting uploads by ajax */ | |
wp_enqueue_script( | |
'myplugin-utilities-ajax', | |
plugins_url( '/assets/js/nameofjsfile.js', __FILE__ ), | |
array( 'jquery' ), | |
'1.0.0', | |
true |
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( $ ) { | |
// hooks everything into document ready | |
$(document).ready( function() { | |
// create a function to actually fire the search | |
function dosearch(t) { | |
// do the ajax request for job search | |
$.ajax({ |
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 | |
/* set the url of the file to sideload - probably be from $_POST or something */ | |
$url = 'http://domain.com/image.jpg'; | |
/** | |
* donwload the url into wordpress | |
* saved temporarly for now | |
*/ | |
$tmp = download_url( $url ); |
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 | |
/** | |
* function wpmark_admin_url_to_unmapped_domain() | |
* | |
* makes all the admin links on the site go to the | |
* original unmapped domain. | |
*/ | |
function wpmark_admin_url_to_unmapped_domain( $url, $path, $blog_id ) { | |
/* get the original site url */ |
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 | |
function wpmark_alter_team_archive_template_query( $query ) { | |
/* only proceed on the front end */ | |
if( is_admin() ) { | |
return; | |
} | |
/* only on the person post archive for the main query */ | |
if ( $query->is_post_type_archive( 'wpmark_person' ) && $query->is_main_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
<?php | |
/* get our array of post ids in term order */ | |
$people = wpmark_get_posts_in_terms_array( | |
array( | |
'orderby' => 'id', | |
'taxonomy' => 'sdance_person_type', | |
'posts' => $wp_query->posts | |
) | |
); |
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 | |
/** | |
* function wpmark_register_before_after_shortcake() | |
*/ | |
function wpmark_register_before_after_shortcake() { | |
shortcode_ui_register_for_shortcode( | |
'before_after_image', // name of shortcode ui | |
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
/** | |
* trigger the before and after images | |
*/ | |
var beforeafter = function() { | |
/* get the preceeding element before the toggle button - hides all the after images */ | |
$( '.before-after-toggle' ).prev().hide(); | |
/* when the element with 'before-after-toggle' class is clicked */ | |
$( '.before-after-toggle' ).click(function() { |
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 | |
/** | |
* function wpmark_add_before_after_shortcode() | |
* adds the shortcode to output the before and after image | |
*/ | |
function wpmark_add_before_after_shortcode( $attr ) { | |
$attr = wp_parse_args( | |
$attr, | |
array( |