Skip to content

Instantly share code, notes, and snippets.

View ms-studio's full-sized avatar

Manuel Schmalstieg ms-studio

View GitHub Profile
@ms-studio
ms-studio / add-term-to-custom-taxonomy.php
Created December 15, 2015 08:10
add term metabox to custom taxonomy - using WP 4.4 term meta functions
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
// CREATE CUSTOM TAXONOMY
add_action( 'init', '___create_my_custom_tax' );
@ms-studio
ms-studio / WP-meta-description-tag.php
Last active April 7, 2022 19:27
WordPress meta description tag
<?php // ** DESCRIPTION v.0.2 **
if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post();
?><meta name="description" content="<?php
$descr = get_the_excerpt();
$text = str_replace( "\r\n", ', ', trim($descr) );
echo esc_attr($text);
?>" />
<?php endwhile; endif; elseif(is_home()) :
?><meta name="description" content="<?php bloginfo('description'); ?>" />
<?php endif; ?>
@ms-studio
ms-studio / ffmpeg_mkv_mp4_conversion.md
Created June 19, 2019 23:21 — forked from jamesmacwhite/ffmpeg_mkv_mp4_conversion.md
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

@ms-studio
ms-studio / add-metabox-to-taxonomy.php
Created December 14, 2015 21:57
simple but complete example of adding metabox to taxonomy - using WP 4.4 term meta functions
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
// REGISTER TERM META
add_action( 'init', '___register_term_meta_text' );
function ___register_term_meta_text() {
@ms-studio
ms-studio / add-several-term-meta-fields-to-custom-taxonomy.php
Last active February 28, 2022 10:02
A variation on the previous gists, this time we add *several* term meta fields
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// original code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
/*
* NOTE:
* We are registering the fields for a custom taxonomy, called "user-logement".
*/
@ms-studio
ms-studio / add-term-to-post-tag.php
Last active September 3, 2021 12:57
add term metabox to post_tag taxonomy - using WP 4.4 term meta functions
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
// REGISTER TERM META
add_action( 'init', '___register_term_meta_text' );
function ___register_term_meta_text() {
I am attesting that this GitHub handle ms-studio is linked to the Tezos account tz1MESCCzDKugDMqwqfbn6jVLiJuZCjS7dXa for tzprofiles
sig:edsigu5w9K54rwGqqcW1MwKkr1KDjvdRzJkibK8tFZnVeNyXZM3zFgcuEHm69ZP8dkxgHs3LCH134RSnULBtdxuEaJUdG7TTk1u
@ms-studio
ms-studio / firstname-lastname.php
Last active November 24, 2020 10:30
Process "Lastname, Firstname" in post titles.
<?php
/**
* Processing "Last name, First name" pairs
*
* @param string $nom_prenom : The original post title ("Wilde, Oscar").
*
* @return string : The human-readable title ("Oscar Wilde").
*
* Usage in theme:
@ms-studio
ms-studio / 010-functions.php
Created August 23, 2012 09:54
Using vimeo API in Wordpress
// vimeo helper function
// Curl helper function
// based on this example
// https://github.com/vimeo/vimeo-api-examples/blob/master/simple-api/simple/simple.php
// detailed explanations are in this post:
// http://ms-studio.net/2012/notes/using-the-vimeo-api-in-wordpress/
function curl_get($url) {
$curl = curl_init($url);
@ms-studio
ms-studio / custom-properties-boilerplate.css
Created January 1, 2020 16:50 — forked from malarkey/custom-properties-boilerplate.css
CSS Custom Properties boilerplate
/* CSS Custom Properties */
:root {
--font-family: 'Georgia', serif;
--font-family-alt: 'Helvetica', Arial, sans-serif;
--font-weight: 400;
--font-weight-bold: 700;
--font-weight-black: 900;
/* 3:4 perfect fourth scale */