Skip to content

Instantly share code, notes, and snippets.

View ambercouch's full-sized avatar

Richard Arnold ambercouch

View GitHub Profile
@ambercouch
ambercouch / admin.php
Last active August 29, 2015 14:01
profile controller
<?php
function profiles($action = FALSE, $id = FALSE) {
$data = $this->data;
//set the file upload path is the method as the admin controler might upload files for different things
$this->original_path = realpath(APPPATH . '../uploads/profiles');
$this->thumbs_path = realpath(APPPATH . '../uploads/profiles/thumbs');
$view_content = __FUNCTION__;
@ambercouch
ambercouch / folder structure
Last active August 29, 2015 14:01
Wordpress as a sub-module
##Put our core files and folders in the cms folder
##Put our content files and folders in the content folder
|--my_wp_folder
| |--index.php
| |--wp-config.php
| |--wp-wapper-config.php
| |--cms
| | |--wp-admin
| | |--wp-includes
@ambercouch
ambercouch / Menu-button.markdown
Last active August 29, 2015 14:02
A Pen by Richie Arnold.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@ambercouch
ambercouch / class.jetpack,php
Created January 18, 2016 07:48
Contact form 7 breaks when using JP Custom CSS. This is the fix.
<?php
class Jetpack {
/**
* Get $content_width, but with a <s>twist</s> filter.
*/
public static function get_content_width() {
$content_width = isset( $GLOBALS['content_width'] ) ? $GLOBALS['content_width'] : false;
return apply_filters( 'jetpack_content_width', $content_width );
}
@ambercouch
ambercouch / Wordpress image alignment placeholder
Last active February 4, 2016 10:00
Sass image alignment placeholder for wordpress themes
%post__img{
img, .wp-caption{
display: block;
max-width:100%;
height: auto;
overflow: hidden;
&.alignleft{
float: left;
margin: 0.5em 1.5em 0.5em 0.5em ;
@ambercouch
ambercouch / functions.php
Created February 4, 2016 12:14
Get only the first category of a post when using get_the_category_list() in your template.
<?php
//filters WordPress the_category_list to return onlt the first category.
function first_cat($cats)
{
return [$cats[0]];
}
add_filter('the_category_list', 'first_cat');
@ambercouch
ambercouch / wp-config.php
Last active June 14, 2016 10:29
Remove <br> tags from contact form 7
<?php
/* wp-contact-from-7 */
define ('WPCF7_AUTOP', false ); // set to false to remove <br> tags
/* That's all, stop editing! Happy blogging. */
@ambercouch
ambercouch / admin.php
Last active July 9, 2016 20:35
WordPress Bones theme remove admin widgets
<?php
// disable default dashboard widgets
function disable_default_dashboard_widgets() {
global $wp_meta_boxes;
// unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); // Right Now Widget
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']); // Activity Widget
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); // Comments Widget
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); // Incoming Links Widget
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
@ambercouch
ambercouch / format-number.js
Last active October 21, 2016 16:05
Format number with thousand separator whilst typing
NWS = {
$inputForm : {},
offset: 0,
FormLength : 0,
FormLengthNew : 0,
char: ' ',
ku: function(selector, char = ' '){
NWS.$inputForm = $(selector);