Skip to content

Instantly share code, notes, and snippets.

View netzgestaltung's full-sized avatar
🏠
Working from home

netzgestaltung

🏠
Working from home
View GitHub Profile
<?php
/**
* @description Echoes custom the_excerpt from any post id. the_excerpt is 7 words long as default
*
* @arguments mixed
* @param array $arguments default NULL array of arguments - the below mentioned + $limit
* @param int $post_id default NULL the id of the post, if null, the current post is taken
* @param string $cut default '...' when nothing setted it will take the current Postcontent from loop and excerpt it
*/
@netzgestaltung
netzgestaltung / admin.js
Last active October 25, 2017 16:48 — forked from zerosignalproductions/admin.js
Insert an image into the wordpress editor always wrapped in a figure tag. The javascript is used to remove the figure element from the editor if the delete button is used. Editing alingnment left/right/center/none is supported.
(function($) {
$(document).ready(function() {
$('body').on('mousedown', 'div[aria-label="Remove"]', function(e) {
var editor = tinyMCE.activeEditor,
element = editor.selection.getNode();
if(element.tagName !== 'FIGURE') {
$(element).parents('figure').remove();
}
});
@netzgestaltung
netzgestaltung / gist:89bd90c9c743a0ee2da55998c9840d36
Created November 8, 2019 09:48 — forked from jaredatch/gist:3764391
Redirect taxonomy to use archive template
<?php
/**
* Redirect taxonomy to use custom post type archive template
*
* @author Jared Atchison
* @link http://jaredatchison.com/code/
* @param string $template
* @return string
*/
function ja_template_redirect( $template ) {
@netzgestaltung
netzgestaltung / responsive-video.css
Last active November 18, 2019 06:04 — forked from jaicab/responsive-video.css
Pure CSS solution for embed videos with an aspect ratio of 16:9
.content figure.video {
position: relative;
padding-bottom: 56.25%; /*16:9*/
}
.content figure.video > video,
.content figure.video > iframe,
.content figure.video > object,
.content figure.video > embed {
position: absolute;
@netzgestaltung
netzgestaltung / OpenSans.css
Last active August 30, 2023 05:08 — forked from sbp/OpenSans.css
CSS for Open Sans
/**
* CSS for Open Sans
* =================
* @Install
* https://google-webfonts-helper.herokuapp.com/fonts/open-sans?subsets=latin
* use modern browser option and subsets you need
* download fonts and upload to your themes font directory
* add the CSS on top of you stylesheet and edit the paths to the current version and relative path of your themes font directory
*
* @Usage
@netzgestaltung
netzgestaltung / country-shortcode.php
Created September 7, 2020 10:09 — forked from MatthewEppelsheimer/country-shortcode.php
WP Contact Form 7 shortcode with list of Countries
<?php
/*
Localizations:
- [Spanish](https://gist.github.com/MatthewEppelsheimer/1498955#gistcomment-3317461) props @chdgp
UPDATED: 2020-03-09
@netzgestaltung
netzgestaltung / cf7-2-post-taxonomy-metabox.php
Created November 24, 2020 07:41
cf7-2-post-taxonomy-metabox.php
<?php
// cleand up and formatting 2020-11-24
/**
* Get taxonomy data
*/
require_once plugin_dir_path( dirname( dirname( __FILE__ ) ) ) . 'includes/class-cf7-2-post-factory.php';
/**
* Get post data
*/