Skip to content

Instantly share code, notes, and snippets.

@jtsternberg
jtsternberg / cmb2-number-field.php
Last active February 13, 2025 09:43
CMB2 Number Field
<?php
$cmb->add_field( array(
'name' => __( 'Postive numbers', 'theme-domain' ),
'desc' => __( 'Numbers only', 'msft-newscenter' ),
'id' => $prefix . 'number',
'type' => 'text',
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
<?php
// Remove 'site-inner' from structural wraps
add_theme_support( 'genesis-structural-wraps', array( 'header', 'footer' ) );
/**
* Landing Content
*
*/
function be_landing_content() {
@billerickson
billerickson / functions.php
Created August 17, 2014 23:06
Using flexible content from ACF without ACF functions.
<?php
$rows = get_post_meta( get_the_ID(), 'be_content', true );
foreach( $rows as $count => $row ) {
switch ( $row ) {
case 'type_1':
$content = get_post_meta( get_the_ID(), 'be_content_' . $count . '_field_name', true );
echo '<div class="type-one">' . wpautop( $content ) . '</div>;
@billerickson
billerickson / functions.php
Created August 17, 2014 23:03
Displaying repeating ACF fields without using ACF functions
<?php
$testimonials = get_post_meta( get_the_ID(), 'be_testimonial', true );
if( $testimonials ) {
echo '<div class="testimonials">';
for( $i = 0; $i < $testimonials; $i++ ) {
$content = get_post_meta( get_the_ID(), 'be_testimonial_' . $i . '_content', true );
if( $content )
echo '<div class="testimonial">' . wpautop( $content ) . '</div>';
}
@GaryJones
GaryJones / .csscomb.json
Created July 5, 2014 08:35
CSScomb config file
{
"exclude": ["node_modules/**", "vendor/**"],
"verbose": true,
"always-semicolon": true,
"block-indent": "\t",
"colon-space": [0, 1],
"color-case": "lower",
"color-shorthand": true,
"combinator-space": [1, 1],
@m-wild
m-wild / cloudflaredns.sh
Last active January 9, 2026 10:35
CloudFlare dynamic dns updater module for Synology
#!/bin/sh
# cloudflareddns.sh - dynamic dns updater module for Synology
#
# Author:
# Michael Wildman (http://mwild.me)
#
# Version:
# 0.2
#
<?php
/**
* Large Image for First Post
*
*/
function be_blog_large_first_image( $image_size ) {
global $wp_query;
if( 0 == $wp_query->current_post && ! get_query_var( 'paged') )
$image_size = 'large';
@justintadlock
justintadlock / register-post-type.php
Last active April 1, 2026 14:04
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@larrybolt
larrybolt / cf-ddns.sh
Last active March 14, 2025 14:12
Automatically update your CloudFlare DNS record to the IP, Dynamic DNS for Cloudflare
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# Automatically update your CloudFlare DNS record to the IP, Dynamic DNS
# Can retrieve cloudflare Domain id and list zone's, because, lazy
# Place at:
# /usr/local/bin/cf-ddns.sh
@bastosmichael
bastosmichael / gist:5376293
Last active December 16, 2015 04:19
Blocking WordPress Botnet for Nginx Configurations
location / {
try_files $uri $uri/ /index.php?$args;
# block WP Botnet workstations
deny 31.184.238.38;
deny 178.151.216.53;
deny 91.224.160.143;
deny 195.128.126.6;
deny 85.114.133.118;
deny 177.125.184.8;
deny 89.233.216.203;