Skip to content

Instantly share code, notes, and snippets.

<?php
add_theme_support( 'starter-content', array(
'attachments' => array(
'featured-image-logo' => array(
'post_title' => 'Featured Logo',
'post_content' => 'Attachment Description',
'post_excerpt' => 'Attachment Caption',
'file' => 'assets/images/featured-logo.jpg',
),
),
<?php
add_action( 'after_setup_theme', 'theme_start_content' );
function theme_starter_content() {
add_theme_support( 'starter-content', array(
'posts' => array(
'home',
'about',
'contact',
<?php
add_action( 'after_setup_theme', 'theme_start_content' );
function theme_starter_content() {
add_theme_support( 'starter-content', array(
'posts' => array(
'test' => array(
'post_type' => 'page',
'post_title' => _x( 'Das ist ein Test', 'theme-slug' ),
<?php
class Mein_Widget extends WP_Widget {
function __construct() {
// Instantiate the parent object
parent::__construct( 'meine-base-id', _x( 'My widget', 'theme-slug' ) );
}
function widget( $args, $instance ) {
<?php
add_action( 'after_setup_theme', 'theme_start_content' );
function theme_starter_content() {
add_theme_support( 'starter-content', array(
'widgets' => array(
'sidebar-1' => array(
'text_business_info',
'search',
array(
<?php
add_action( 'after_setup_theme', 'theme_start_content' );
function theme_starter_content() {
add_theme_support( 'starter-content', array(
'widgets' => array(
'sidebar-1' => array(
'text_business_info',
'search',
),
@websupporter
websupporter / rest-api-nonces.php
Created January 18, 2017 11:57
Example Script for my blog post on Nonces in the REST API
<?php
/**
* Plugin Name: Nonces in der REST API
* Author: Websupporter
* Plugin URL: http://websupporter.net/blog/de/nonces-in-der-rest-api/
* Licence: GPL
**/
@websupporter
websupporter / rest-api-nonces-not-working.php
Created January 18, 2017 11:56
Example Code for my blog post of REST API and Nonces
<?php
/**
* Plugin Name: Nonces in der REST API Not working
* Author: Websupporter
* Plugin URL: http://websupporter.net/blog/de/nonces-in-der-rest-api/
* Licence: GPL
**/
add_action( 'wp_ajax_nonce-test', 'ajax_nonce_test' );
@websupporter
websupporter / authorbio-shortcode-auto-include.php
Created January 2, 2017 19:41
Add the authorbio shortcode automatically.
<?php
add_filter( 'the_content', function( $content, $post_id ) {
// Run only on blog posts.
if ( 'post' !== get_post_type( $post_id ) ) {
return $content;
}
// Do not run on the old blog posts, where we already have placed our author bio.
@websupporter
websupporter / add-frontkit-support.php
Created October 25, 2016 05:12
Add FrontKit support
<?php
add_action( 'after_setup_theme', 'add_frontkit_support' );
function add_frontkit_support() {
add_theme_support( 'frontkit', array(
'title' => '.single-post .entry-title',
'content' => '.single-post .entry-content',
) );
}