Skip to content

Instantly share code, notes, and snippets.

@rohmann
rohmann / wp-dont-add-to-main-blog.php
Created September 2, 2013 02:19
Don't add a user to the primary blog on signup. http://git.io/thkt6g
<?php
add_action('wpmu_activate_blog','remove_user_from_primary_site',999,5);
function remove_user_from_primary_site($blog_id, $user_id, $password, $title, $meta){
remove_user_from_blog($user_id,1);
}
@rohmann
rohmann / hide-siteurl-option.php
Created September 7, 2013 22:39
Some CSS to hide the Site URL and Home URL from the Wordpress settings page. http://git.io/fFVxOA
<?php
add_action('admin_head', 'custom_admin_css');
function custom_admin_css() { ?>
<style>
label[for=siteurl], input[name=siteurl], label[for=home], input[name=home], input[name=home] + p.description {
display: none;
}
</style>
<?php
<?php
class View {
public static function __callStatic($name,$parameters) {
try {
//Get template name from method call
$fname = TEMPLATES_DIR . implode('/', explode("_",$name) ).'.php';
@rohmann
rohmann / escalate.php
Created October 25, 2013 18:53
Tool to esaclate an admin to super admin in WordPress
<?php
/*
Plugin Name: Escalate to Super Admin
Plugin URI: https://gist.github.com/rohmann/7159907
Description: Tool to convert normal admin to super admin.
Place in mu-plugins folder. Then visit /wp-admin with a normal admin account. Next, go to the network dashboard to test it. Finally, delete this plugin to prevent abuse
Author: Alexander Rohmann
Author URI: https://gist.github.com/rohmann
Version: 1.0
*/
@rohmann
rohmann / mp-promo-tagging.php
Last active December 29, 2015 14:59
When "on sale" is toggled, a "promo" tag will automatically be added/removed from the product. http://git.io/pOvGzg
<?php
function auto_tag_on_sale( $meta_id, $post_id, $meta_key) {
if ('mp_is_sale' != $meta_key){
return;
}
$meta = get_post_custom($post_id);
$on_sale = false;
/**
* Add the cs-row-flip class to a row, and the column direction will be reversed.
*/
.x-container.marginless-columns.cs-row-flip {
direction: rtl;
}
.x-container.marginless-columns.cs-row-flip > .x-column {
direction: ltr;
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init: function () {
this._super();
Ember.run.schedule("afterRender",this,function() {
this.send("later");
});
@rohmann
rohmann / app-view.js
Created September 14, 2016 18:50
Add class to Ember Application (after 2.7.0)
// instance-initializers/app-view.js
// With an instance initializer, we can register a component for Ember to use at the top level.
// Not ideal, but it works in the meantime until routable components drop.
import Ember from 'ember';
const AppView = Ember.Component.extend({
classNames: ['my-app'],
});
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '',
markup: Ember.computed('state',function(){
return `<div><strong>${this.get('state')}</strong><div><!--morph:yield--></div></div>`;
}),
});