Skip to content

Instantly share code, notes, and snippets.

View cristianstan's full-sized avatar
🎯
Focusing

Cristian Stan cristianstan

🎯
Focusing
View GitHub Profile
<?php
class envato_marketplace {
public static $base_url = 'http://marketplace.envato.com/api/edge/';
public function curl($path) {
$ch = curl_init(self::$base_url . $path);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
@chrisguitarguy
chrisguitarguy / comments-example.php
Created September 21, 2011 21:44
How to add custom fields to WordPress comments
<?php
/*
Plugin Name: Add Extra Comment Fields
Plugin URI: http://pmg.co/category/wordpress
Description: An example of how to add, save and edit extra comment fields in WordPress
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
License: MIT
*/
@JeffreyWay
JeffreyWay / jquery-method.js
Created January 3, 2012 20:01
Envato Marketplace API - Get Popular Items and Authors
$.getJSON('http://173.255.193.46/api/edge/popular:themeforest.json?callback=?', function(files) {
var imgs;
files = files.popular;
console.log(files); // see what's available to play with
imgs = $.map(files.items_last_week, function(file, i) {
return '<a href="' + file.url + '"><img src=' + file.thumbnail + '></a>';
});
@helen
helen / repeatable-fields-metabox.php
Created January 11, 2012 04:42
Repeating Custom Fields in a Metabox
<?
/**
* Repeatable Custom Fields in a Metabox
* Author: Helen Hou-Sandi
*
* From a bespoke system, so currently not modular - will fix soon
* Note that this particular metadata is saved as one multidimensional array (serialized)
*/
function hhs_get_sample_options() {
@l2aelba
l2aelba / gist:4450989
Last active August 18, 2020 18:43
Wordpress : Custom search page and search by title, content and tag
<?php
include('../../../../wp-config.php');
$keyword = $_GET['k'];
search($wpdb->get_results("SELECT * from wp_posts WHERE post_title LIKE '$keyword%'"), "Full keyword");
$keywords_split = explode(" ",$keyword);
for($i=0;$i<count($keywords_split);$i++){
search($wpdb->get_results("SELECT * from wp_posts WHERE post_title LIKE '$keywords_split[$i]%'") ,"Split keyword = '$keywords_split[$i]'");
@juanbzpy
juanbzpy / wpinstall
Created December 20, 2013 06:22
Install WordPRess
#!/bin/bash -e
# Install WordPress and clean the folder
echo "======================"
echo " Installing WordPress "
echo "======================"
echo ""
# Download the files (cURL works fine here too)
wget http://wordpress.org/latest.tar.gz
@Zenger
Zenger / envato-class.php
Created January 23, 2014 07:37
Confirm user license key on envato marketplaces
<?php
class Envato
{
protected static $key = "";
protected static $username = "";
public static function verify( $code )
<?php
/**
* Wrapper class for the Envato marketplaces API.
*
* @author Jeffrey Way <jeffrey@envato.com>
* @created January, 2012
* @license Do-whateva-ya-want-with-it
*/
@joedajigalo
joedajigalo / wordpress_while_loop.php
Last active August 21, 2018 11:32
Create a WordPress While Loop
<?php
/* Create a WordPress While Loop
-------------------------------------------------- */
$wordpress_loop_argument = array(
'post_type' => 'custom_post_type',
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'ASC'
);
<?php
/*
Register Fonts
*/
function studio_fonts_url() {
$font_url = '';
/*
Translators: If there are characters in your language that are not supported
by chosen font(s), translate this to 'off'. Do not translate into your own language.