Skip to content

Instantly share code, notes, and snippets.

View stankobrin's full-sized avatar

Stan Kobrin stankobrin

View GitHub Profile
@stankobrin
stankobrin / 0_reuse_code.js
Created May 24, 2014 18:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@stankobrin
stankobrin / functions.php
Created August 2, 2014 17:53
Create new Wordpress post [wp_insert_post] based on results of a WP_Query
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 / frontend.php
Created August 5, 2014 05:55
front end posting
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 / ajax.js
Created August 5, 2014 05:57
ajax call
// JavaScript Document
function apfaddpost(posttitle,postqty,postlink,postcode,postdesc,postprice) {
jQuery.ajax({
type: 'POST',
url: apfajax.ajaxurl,
data: {
@stankobrin
stankobrin / query
Created August 10, 2014 15:05
query
<?php
if ( $query->have_posts() ) { ?>
<?php $count = 0; ?>
<?php while ( $query->have_posts() ) {
$query->the_post();
?>
@stankobrin
stankobrin / apf_post_form
Created August 10, 2014 15:08
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"/>
@stankobrin
stankobrin / apf.js
Created August 10, 2014 15:09
apf.js
// JavaScript Document
function apfaddpost(posttitle,postqty,postlink,postcode,postdesc,postprice) {
jQuery.ajax({
type: 'POST',
url: apfajax.ajaxurl,
data: {