Skip to content

Instantly share code, notes, and snippets.

@brynner
brynner / dom.js
Last active August 16, 2018 15:43
Add data to HTML according to object's property name
// Add data to HTML according to object´s property name
function addContentFromDataToHtml(object, dataSet) {
recursiveObject({object: object, callback: addContentFromDataToHtmlCallback, dataSet: dataSet});
}
function recursiveObject(recursiveParams) {
if (recursiveParams.parentsItem) {
recursiveParams.parentsItem = recursiveParams.parentsItem+'.';
} else {
recursiveParams.parentsItem = '';
}
@HoldOffHunger
HoldOffHunger / bradvin.social.share.urls.txt
Last active April 18, 2024 13:41
Social Share URL's (Summary)
https://www.facebook.com/sharer.php?u={url}
https://www.facebook.com/dialog/share?app_id={app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}
https://reddit.com/submit?url={url}&title={title}
https://twitter.com/intent/tweet?url={url}&text={title}&via={user_id}&hashtags={hash_tags}
https://www.linkedin.com/sharing/share-offsite/?url={url}
https://api.whatsapp.com/send?phone={phone_number}&text={title}%20{url}
https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={text}&tags={hash_tags}
http://pinterest.com/pin/create/button/?url={url}
https://www.blogger.com/blog-this.g?u={url}&n={title}&t={text}
https://www.evernote.com/clip.action?url={url}&title={title}
@damiencarbery
damiencarbery / cmb2-repeater-demo-display-data.php
Last active September 9, 2023 02:53
CMB2 Repeater Demo - a simple example
<?php
add_filter( 'the_content', 'crd_append_post_links' );
function crd_append_post_links( $content ) {
if ( is_page() ) {
$post_links_data = get_post_meta( get_the_ID() );
if ( isset( $post_links_data[ 'blog_group' ][ 0 ] ) ) {
$blog_list = maybe_unserialize( $post_links_data[ 'blog_group' ][ 0 ] );
$posts_list = '<ul>';
foreach ( $blog_list as $post_info ) {
@carlodaniele
carlodaniele / custom-queries.php
Last active January 23, 2024 01:35
An example plugin showing how to add custom query vars, rewrite tags and rewrite rules to WordPress
<?php
/**
* @package Custom_queries
* @version 1.0
*/
/*
Plugin Name: Custom queries
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele
@dsmy
dsmy / wptaxmecheckbox.php
Last active June 26, 2019 10:39
Taxonomy checkbox list
/**
* returns taxonomy lists that have children with checkboxes
*
*/
function get_subject_list($taxonomy){
// Sets the taxonomy to pull a list of terms from.
// Throws them into a nifty object for referencing and counting
$terms = get_terms($taxonomy,array('parent' => 0));
if ($terms) {