Skip to content

Instantly share code, notes, and snippets.

View christophherr's full-sized avatar

Christoph Herr christophherr

View GitHub Profile
@christophherr
christophherr / change-custom-logo-schema-markup.php
Last active February 15, 2019 11:07
Change custom_logo Schema markup
/**
* Use one of the filters. Not multiple...
* I'd use the third.
*/
add_filter( 'wp_get_attachment_image_attributes', function ( $attr ) {
if ( isset( $attr['class'] ) && 'custom-logo' === $attr['class'] ) {
$attr['itemprop'] = 'image';
}
<?php
/**
* Tests for add() method of _Beans_WP_Customize.
*
* @package Beans\Framework\Tests\Unit\API\WP-Customize
*
* @since 1.5.0
*/
namespace Beans\Framework\Tests\Unit\API\WPCustomize;
.genesis-nav-menu .menu-item:hover > .sub-menu,
.genesis-nav-menu .menu-item:focus > .sub-menu {
display: block;
left: auto;
opacity: 1;
}
.genesis-nav-menu .sub-menu {
display: block;
clear: both;
<?php
/* Path to the WordPress codebase you'd like to test. Add a forward slash in the end. */
define( 'ABSPATH', dirname( __FILE__ ) . '/src/' );
/*
* Path to the theme to test with.
*
* The 'default' theme is symlinked from test/phpunit/data/themedir1/default into
* the themes directory of the WordPress install defined above.
@christophherr
christophherr / index.js
Last active January 13, 2018 19:14
UI KIt Card GutenBlock
/**
* Block dependencies
*/
//import icon from './icon';
/**
* Internal block libraries
*/
const { __ } = wp.i18n;
const { registerBlockType, Editable } = wp.blocks;
@christophherr
christophherr / failures.txt
Created November 23, 2017 20:51
Beans unit test failures on windows
c:\laragon\www\beans\wp-content\themes\Beans (windows-fix -> tonya)
λ composer test-unit
> "vendor/bin/phpunit" --testsuite unit
PHPUnit 5.7.25 by Sebastian Bergmann and contributors.
Runtime: PHP 7.1.11
Configuration: C:\laragon\www\beans\wp-content\themes\Beans\phpunit.xml.dist
Error: No code coverage driver is available
.....................................F...FFFFFFFFFFFFFF 55 / 55 (100%)
@christophherr
christophherr / extensions.txt
Last active October 31, 2017 01:34
VS Code Extensions
advanced-new-file - Version :0.5.0
Align - Version :0.2.0
auto-close-tag - Version :0.5.2
beautify - Version :1.1.1
bracket-pair-colorizer - Version :0.10.10
code-settings-sync - Version :2.8.3
CreateModule - Version :0.0.5
CSSLint - Version :0.0.3
debugger-for-chrome - Version :3.4.0
docthis - Version :0.6.0
@christophherr
christophherr / countdown-timer.html
Created January 21, 2017 00:59
Countdown timer with jQuery.countdown and JS to change the HTML aftter the end of the countdown
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="webinar-timer">
<span class="webinar-countdown"></span>
/**
* @ticket 38486
*/
function test_class_applied_to_page_for_posts_on_custom_post_type() {
$page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'Home Page' ) );
update_option( 'page_for_posts', $page_id );
$cpt_id = self::factory()->post->create( array( 'post_type' => 'cpt', 'post_name' => 'cpt-name' ) );
wp_update_nav_menu_item( $this->menu_id, 0, array(
@christophherr
christophherr / forth-unit-test-35272.php
Created October 26, 2016 18:21
Forth unit test 35272
function test_class_not_applied_to_page_item() {
$page_id1 = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'Home Page' ) );
update_option( 'page_on_front', $page_id1 );
$page_id2 = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'Test Page' ) );
wp_update_nav_menu_item( $this->menu_id, 0, array(
'menu-item-type' => 'post_type',
'menu-item-object' => 'page',
'menu-item-object-id' => $page_id1,