Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Thomas Weichselbaumer Netzberufler

👋
View GitHub Profile
@Netzberufler
Netzberufler / gulpfile.js
Created Sep 9, 2016
Gulpfile: Erster Einstieg
View gulpfile.js
// Load Gulp
var gulp = require('gulp');
// Load Plugins
var rename = require( 'gulp-rename' );
var uglify = require( 'gulp-uglify' );
// Minify JS
gulp.task( 'minifyjs', function() {
return gulp.src( ['js/navigation.js'] )
@Netzberufler
Netzberufler / functions.php
Last active Sep 10, 2016
Social Icons Menu
View functions.php
<?php
/**
* Sets up theme defaults and registers support for various WordPress features.
*/
function theme_slug_setup() {
// Register Social Icons Menu.
register_nav_menu( 'social', esc_html__( 'Social Icons', 'theme-slug' ) );
}
View category-dropdown-control.php
/**
* Make sure that custom controls are only defined in the Customizer
*/
if ( class_exists( 'WP_Customize_Control' ) ) :
/**
* A custom category dropdown control for the Customizer
*/
class Theme_Slug_Category_Dropdown_Control extends WP_Customize_Control {
/**
@Netzberufler
Netzberufler / functions.php
Created Sep 19, 2016
Read More Button nach Excerpt einfügen
View functions.php
<?php
/**
* Add Read More button to excerpts
*
* @param string $more_text Excerpt More Text.
* @return string
*/
function themeslug_excerpt_more( $more_text ) {
return '<a href="' . esc_url( get_permalink() ) . '" class="more-link">' . esc_html__( 'Continue reading', 'themeslug' ) . '</a>';
@Netzberufler
Netzberufler / functions.php
Created Sep 19, 2016
Font Size von Tag Cloud Widget ändern
View functions.php
<?php
/**
* Modifies tag cloud widget arguments to have all tags in the widget same font size.
*
* @param array $args Arguments for tag cloud widget.
* @return array A new modified arguments.
*/
function themeslug_widget_tag_cloud_args( $args ) {
$args['largest'] = 0.8125;
$args['smallest'] = 0.8125;
@Netzberufler
Netzberufler / functions.php
Created Sep 22, 2016
Blank Wordpress Child Theme
View functions.php
<?php
/**
* Theme Coder Child functions and definitions
*
* @package Theme Coder
*
*/
/**
* Enqueue scripts and styles.
@Netzberufler
Netzberufler / customizer.php
Last active Sep 23, 2016
Sanitization callback for select and radio type Customizer controls.
View customizer.php
<?php
/**
* Sanitization callback for 'select' and 'radio' type controls.
*
* @copyright Copyright (c) 2015, WordPress Theme Review Team, https://github.com/WPTRT/code-examples
* @see sanitize_key() https://developer.wordpress.org/reference/functions/sanitize_key/
* @see $wp_customize->get_control() https://developer.wordpress.org/reference/classes/wp_customize_manager/get_control/
*
* @param String $input Slug to sanitize.
* @param WP_Customize_Setting $setting Setting instance.
@Netzberufler
Netzberufler / customizer.php
Last active Feb 26, 2018
Sidebar Layout Option im WordPress Customizer
View customizer.php
<?php
/**
* Adds Layout Options section and sidebar position setting.
*
* @param WP_Customize_Manager $wp_customize The Customizer object.
*/
function theme_slug_customize_register( $wp_customize ) {
// Add layout options section.
$wp_customize->add_section( 'theme_slug_layout_options', array(
@Netzberufler
Netzberufler / functions-2.php
Last active Oct 4, 2016
WordPress Core Archive Title Function
View functions-2.php
<?php
/**
* Filter the default archive title.
*
* @param string $title Archive title.
* @return string $title
*/
function theme_slug_archive_title( $title ) {
if ( is_category() ) {
@Netzberufler
Netzberufler / footer.php
Last active Mar 9, 2021
Footer Widgets
View footer.php