Skip to content

Instantly share code, notes, and snippets.

@justkabin
justkabin / allowedtags.php
Created April 1, 2023 05:08 — forked from neilgee/allowedtags.php
Add back in HTML Tag Suggestions to Comments in WordPress
<?php //<~ don't add me in
add_action('init', 'wpb_allowedtags_comments', 10);
function wpb_allowedtags_comments() {
define('CUSTOM_TAGS', true);
global $allowedtags;
$allowedtags = array(
'a' => array(
@justkabin
justkabin / <domain>.conf
Created July 25, 2022 08:01 — forked from pviojo/<domain>.conf
Nginx conf. Wordpress blog in a subdirectory (/blog)
server {
listen 80;
server_name <domain>
server_name_in_redirect off;
access_log logs/<domain>.access.log;
error_log logs/<domain>.error.log;
gzip_static on;
@justkabin
justkabin / class.envato2.php
Created August 29, 2021 18:35 — forked from dtbaker/class.envato2.php
Using the verify-purchase endpoint of the new Envato API to validate a purchase code.
<?php
// NOTE: verify-purchase has been deprecated and it's best to use the new /author/sale endpoint as documented on http://build.envato.com/
// created by Envato user wpdreams https://forums.envato.com/t/verify-purchase-class/3526
// usage example:
$o = EnvatoApi2::verifyPurchase( $purchase_code );
@justkabin
justkabin / example.php
Created December 8, 2020 10:22 — forked from jonathonbyrdziak/example.php
Wordpress Metabox, stand alone class for multiple metabox abilities
<?php
/*
Here's a couple of metaboxes that I've recently created using this system
*/
$subpostings = redrokk_metabox_class::getInstance('subpostings', array(
'title' => '(optional) Subscription for Postings',
'description' => "As an optional feature, you have a complete api at your disposal which will allow you the ability to offer and manage member posts. In addition to these settings, you may need to create the associated pages for accepting posts from your frontend.",
@justkabin
justkabin / Frontend user profile in WordPress
Created April 3, 2019 07:30 — forked from chrisdigital/Frontend user profile in WordPress
Setting up a editable user profile in WordPress on the frontend.
//How to edit a user profile on the front end?
//http://wordpress.stackexchange.com/questions/9775/how-to-edit-a-user-profile-on-the-front-end
//Forcing nickname as display_name in custom edit profile template
//http://wordpress.stackexchange.com/questions/35403/forcing-nickname-as-display-name-in-custom-edit-profile-template
///////
<?php
@justkabin
justkabin / dynamicvideo.js
Created August 7, 2018 12:16 — forked from gerbenvandijk/dynamicvideo.js
Dynamically loading a HTML5 video element with JavaScript
function loadVid(){
var videourl = 'urltoyourvideo here'; // set the url to your video file here
var videocontainer = '#videocontainer'; // set the ID of the container that you want to insert the video in
var parameter = new Date().getMilliseconds(); // generate variable based on current date/time
var video = '<video width="1102" height="720" id="intro-video" autoplay loop src="' + videourl + '?t=' + parameter + '"></video>'; // setup the video element
$(videocontainer).append(video); // insert the video element into its container
@justkabin
justkabin / wpa-clean-header.php
Created July 28, 2018 14:52 — forked from Auke1810/wpa-clean-header.php
create a clean wordpress header and remove unnecessary clutter.
<?php
/*
Plugin Name: wordpress assist clean header
Plugin URI: http://www.wordpressassist.nl/
Description: Remove shortlink hook
Version: 1.0
Author: AukeJomm
Author URI: http://www.aukejongbloed.nl
*/
@justkabin
justkabin / wordpress-fetch-rss-feed.php
Created July 23, 2018 10:54
Fetch RSS Feed in WordPress
<?php
include_once(ABSPATH . WPINC . '/feed.php');
if(function_exists('fetch_feed')) {
$feed = fetch_feed('http://example.com/feed/');
if (!is_wp_error($feed)) : $feed->init();
$feed->set_output_encoding('UTF-8'); // set encoding
$feed->handle_content_type(); // ensure encoding
$feed->set_cache_duration(21600); // six hours in seconds
@justkabin
justkabin / rss-fetch-feed.php
Created July 23, 2018 10:54 — forked from deepak-rajpal/rss-fetch-feed.php
RSS XML News Feeds Fetch using WordPress fetch_feed() - Best and Tested
<?php
/* =============== Starts: Shortcode to display RSS Feeds using WordPress fetch_feed() ================== */
/* Shortcode Example: [news_list]
Example Feed URL:
=> 'http://online.wsj.com/xml/rss/3_8068.xml'
=> 'http://dealbook.nytimes.com/feed/'
=> 'http://www.bloomberg.com/feed/bview/'
*/
function news_page_fx( $atts ) {
extract( shortcode_atts( array(
@justkabin
justkabin / wprssgrabber.php
Last active July 23, 2018 10:50 — forked from betweenbrain/gist:5405671
Use cURL and SimpleXML to retrieve and parse Wordpress RSS feed
<?php
$curl = curl_init();
curl_setopt_array($curl, Array(
CURLOPT_URL => 'http://blogs.guggenheim.org/map/feed/',
CURLOPT_USERAGENT => 'spider',
CURLOPT_TIMEOUT => 120,
CURLOPT_CONNECTTIMEOUT => 30,
CURLOPT_RETURNTRANSFER => TRUE,