Skip to content

Instantly share code, notes, and snippets.

View noeltock's full-sized avatar
🚀
Ship it.

Noel Tock noeltock

🚀
Ship it.
View GitHub Profile
<?php
function change_post_label() {
global $menu;
global $submenu;
$menu[5][0] = 'News';
$submenu['edit.php'][5][0] = 'News';
$submenu['edit.php'][10][0] = 'Add News';
$submenu['edit.php'][16][0] = 'News Tags';
<?php
/* Create Custom Post Type (CPT)
------------------------------------*/
function create_livestream_posttype() {
$args = array(
'label' => 'Livestream',
'public' => false,
<?php
function change_landing_page() {
return admin_url( 'edit.php?post_type=page' );
}
add_filter( 'login_redirect', 'change_landing_page' );
<?php
function remove_menu_items() {
remove_menu_page( 'index.php' );
remove_menu_page( 'separator1' );
remove_menu_page( 'upload.php' );
}
<?php
function change_author_capabilities() {
$role = get_role( 'author' ) ;
$role->remove_cap( 'edit_published_posts' );
$role->remove_cap( 'publish_posts' );
$role->remove_cap( 'delete_published_posts' );
$role->remove_cap( 'edit_posts' );
$role->remove_cap( 'delete_posts' );
@noeltock
noeltock / functions.php
Last active December 16, 2015 03:39
Universal Analytics / WordPress
<?php
function nt_ga_word_count() {
global $post;
$id = $post->ID;
$count = str_word_count( get_post_field( 'post_content', $id ) );
return ceil( $count / 100 ) * 100;
}
@noeltock
noeltock / signup.html
Created December 7, 2012 09:05
Signup form
<form action="http://emeeyou.us6.list-manage.com/subscribe/post?u=ab16cf9e9c06e90a554072323&amp;id=6249513508" method="post" name="mc-embedded-subscribe-form" novalidate>
<input type="text" value="" name="FNAME" placeholder="First Name" required>
<input type="email" value="" name="EMAIL" placeholder="Email Address" required>
<input type="submit" value="Send me Updates!" name="subscribe">
</form>
<picture class="hammy-responsive aligncenter size-full wp-image-1359" alt="Stingray Bahamas">
<source src="613634839.jpg">
<source src="153551458.jpg" media="(min-width:320px)">
<source src="208663373.jpg" media="(min-width:480px)">
<source src="273462677.jpg" media="(min-width:600px)">
<source src="128931865.jpg" media="(min-width:740px)">
<noscript>
<img src="stingray.jpg" alt="Stingray Bahamas">
</noscript>
</picture>
<img class="aligncenter size-full wp-image-1359" title="stingray" src="stingray.jpg" alt="Stingray Bahamas" width="745" height="496" />
/**
* jquery.gridrotator.js v1.0.0
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2012, Codrops
* http://www.codrops.com
*/