Skip to content

Instantly share code, notes, and snippets.

@vielhuber
vielhuber / index.php
Last active July 17, 2023 14:20
load wpdb outside in external php file #php #wordpress
<?php
// minimal version
define( 'SHORTINIT', true );
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
// medium version (With lots of overhead)
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
// full version (including functions and 200 header)
define( 'SHORTINIT', true );
add_filter( 'wpas_get_custom_fields', 'wpas_make_product_required' );
/**
* Make the products field required
*
* @param array $custom_fields Registered custom fields
*
* @return array
*/
function wpas_make_product_required( $custom_fields ) {
@paulcollett
paulcollett / functions.php
Last active May 12, 2025 03:57
Remove Yoast HTML Comments “This site is optimized with the Yoast WordPress SEO plugin”
// For Yoast SEO Plugin Version: 14.1+ add to your Wordpress Theme's functions.php...
// Remove All Yoast HTML Comments
// https://gist.github.com/paulcollett/4c81c4f6eb85334ba076
// Credit @devendrabhandari (https://gist.github.com/paulcollett/4c81c4f6eb85334ba076#gistcomment-3303423)
add_filter( 'wpseo_debug_markers', '__return_false' );
// For Yoast SEO Plugin Version: < 14.1 add to your Wordpress Theme's functions.php...
@jazzsequence
jazzsequence / breadcrumbs.php
Created October 11, 2012 19:41
WordPress SEO Breadcrumbs
/**
* SEO Breadcrumbs
* @author Chris Reynolds
* @link http://www.quickonlinetips.com/archives/2012/02/wordpress-seo-breadcrumbs/
* Search engine optimized breadcrumbs. Original source was taken from the link above, with changes made so that it supports pages as well as posts and integrates into Twitter Bootstrap breadcrumb styles
*/
function seo_breadcrumbs() {
// this sets up some breadcrumbs for posts & pages that support Twitter Bootstrap styles
$separator = ' <span class="divider">&rsaquo;</span>';
echo '<ul xmlns:v="http://rdf.data-vocabulary.org/#" class="breadcrumb">';
@apanzerj
apanzerj / curlWrap.php
Created June 12, 2012 23:58
curlWrap function.
<?php
define("ZDAPIKEY", "");
define("ZDUSER", "");
define("ZDURL", "https://subdomain.zendesk.com/api/v2");
/* Note: do not put a trailing slash at the end of v2 */
function curlWrap($url, $json, $action)
{
$ch = curl_init();
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/