Skip to content

Instantly share code, notes, and snippets.

Avatar

Stan Kobrin stankobrin

View GitHub Profile
View apf.js
// JavaScript Document
function apfaddpost(posttitle,postqty,postlink,postcode,postdesc,postprice) {
jQuery.ajax({
type: 'POST',
url: apfajax.ajaxurl,
data: {
View apf_post_form
function apf_post_form()
{
?>
<form id="apfform" action="" method="post"enctype="multipart/form-data">
<div id="apf-text">
<input type="hidden" id="apflink" name="apflink" value="508"/>
<input type="hidden" id="apftitle" name="apftitle" value="SOI<?php the_ID();?>"/>
<input type="text" class="orderresult_qty" id="apfqty" name="apfqty"/>
View query
<?php
if ( $query->have_posts() ) { ?>
<?php $count = 0; ?>
<?php while ( $query->have_posts() ) {
$query->the_post();
?>
View ajax.js
// JavaScript Document
function apfaddpost(posttitle,postqty,postlink,postcode,postdesc,postprice) {
jQuery.ajax({
type: 'POST',
url: apfajax.ajaxurl,
data: {
View frontend.php
define('APFSURL', WP_PLUGIN_URL."/".dirname( plugin_basename( __FILE__ ) ) );
define('APFPATH', WP_PLUGIN_DIR."/".dirname( plugin_basename( __FILE__ ) ) );
function apf_enqueuescripts()
{
wp_enqueue_script('apf', APFSURL.'/js/apf.js', array('jquery'));
wp_localize_script( 'apf', 'apfajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
}
add_action('wp_enqueue_scripts', apf_enqueuescripts);
@stankobrin
stankobrin / functions.php
Created Aug 2, 2014
Create new Wordpress post [wp_insert_post] based on results of a WP_Query
View functions.php
add_filter('uwpqsf_result_tempt', 'customize_output', '', 4);
function customize_output($results , $arg, $id, $getdata ){
// The Query
$apiclass = new uwpqsfprocess();
$query = new WP_Query( $arg );
ob_start(); $result = '';
// The Loop
if ( $query->have_posts() ) { ?>
@stankobrin
stankobrin / 0_reuse_code.js
Created May 24, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console