Skip to content

Instantly share code, notes, and snippets.

@bacoords
bacoords / at_a_glance_CPT.css
Last active April 20, 2016 15:29
Change icon for "At a Glance" on WP Dashboard
/* Change icon for "At a Glance" on WP Dashboard */
#dashboard_right_now .{custom-post-type}-count a:before, #dashboard_right_now .{custom-post-type}-count span:before{
content: "{glyphicon}";
}
/*Example*/
#dashboard_right_now .invoice-count a:before, #dashboard_right_now .invoice-count span:before{
content: "\f529";
}
@bacoords
bacoords / page-insert-from-json-file.php
Last active March 15, 2020 08:20
Page template ton insert via json file
<?php
//Template Name: Insert Json File
//Testing Mode First
$test = true;
//If we've uploaded our JSON file with our theme
$url = get_template_directory_uri() . 'json/my-new-posts.json';
//Convert our JSON into a PHP Array
@bacoords
bacoords / page-insert-from-google-sheets.php
Last active December 8, 2016 22:27
Page template to insert Google Sheets JSON feed into WordPress
<?php
//Template Name: Insert Json from Google Sheets
//Testing Mode First
$test = true;
//Google Sheet JSON Feed Url
$url = 'https://spreadsheets.google.com/feeds/list/{{UNIQUE-ID}}/od6/public/values?alt=json';
//Convert our JSON into a PHP Array
add_action( 'init', prefix_book_posttype' );
function prefix_book_posttype() {
$labels = array(
'name' => _x( 'Books', 'post type general name', 'your-plugin-textdomain' ),
'singular_name' => _x( 'Book', 'post type singular name', 'your-plugin-textdomain' ),
'menu_name' => _x( 'Books', 'admin menu', 'your-plugin-textdomain' ),
'name_admin_bar' => _x( 'Book', 'add new on admin bar', 'your-plugin-textdomain' ),
'add_new' => _x( 'Add New', 'book', 'your-plugin-textdomain' ),
'add_new_item' => __( 'Add New Book', 'your-plugin-textdomain' ),
'new_item' => __( 'New Book', 'your-plugin-textdomain' ),
@bacoords
bacoords / wp-tinymce-fontsize.md
Last active June 9, 2016 17:03
Snippet to change TINYMCE fontsize to EMs

functions.php snippet to change TINYMCE fontsize to EMs

Source: wpexplorer.com

// Customize mce editor font sizes
if ( ! function_exists( 'wpex_mce_text_sizes' ) ) {
	function wpex_mce_text_sizes( $initArray ){
		$initArray['fontsize_formats'] = "0.25em 0.5em 0.75em 1em 1.25em 1.5em 1.75em 2em 2.25em 2.5em 2.75em 3em 3.25em 3.5em 3.75em 4em 4.25em 4.5em 4.75em 5em 5.25em 5.5em 5.75em 6em";
 return $initArray;