Skip to content

Instantly share code, notes, and snippets.

View alexwoollam's full-sized avatar
:octocat:

Alexander King Woollam alexwoollam

:octocat:
View GitHub Profile
@alexwoollam
alexwoollam / matchsidebar.js
Last active September 30, 2018 17:32
wordpress match sidebar and body height
//This will match the pages content height if the sidebar is bigger.
getSidebarHeight();
function getSidebarHeight(){
var sidebar = document.getElementById('sidebar_inner');//<- Sidebar ID
var sidebarHeight = sidebar.offsetHeight;
var body = document.getElementById('postBody'); //<- Body ID
var contentHeight = body.offsetHeight;
var sidebarHeightPixels = sidebarHeight + "px";
if(contentHeight < sidebarHeight){
@alexwoollam
alexwoollam / functions.php
Last active June 14, 2018 10:42
possible ai1ec bst/gmt fix
<?php
$query = "SELECT * FROM {$wpdb->posts} JOIN {$wpdb->prefix}ai1ec_events on ({$wpdb->prefix}ai1ec_events.post_id={$wpdb->posts}.ID)
WHERE post_type='ai1ec_event' AND post_status='publish' AND {$wpdb->prefix}ai1ec_events.start > '".time()."' ORDER BY {$wpdb->prefix}ai1ec_events.start limit 3";
$results = $wpdb->get_results( $query ); // get result form the query
ob_start();
foreach($results as $result){
$title = ($result->post_title); // Returns the post type title
@alexwoollam
alexwoollam / function.php
Last active March 10, 2022 00:29 — forked from mattclements/function.php
Wordpress Disable Comments (add to function.php)
<?php
/**
* Disables comments, Add below to existing function.php file.
*/
/** Disable support for comments and trackbacks in post types. */
function df_disable_comments_post_types_support() {
$post_types = get_post_types();
foreach ( $post_types as $post_type ) {
if ( post_type_supports( $post_type, 'comments' ) ) {
<?php
// ===================================================
// Load database info and local development parameters
// ===================================================
if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) {
define( 'WP_LOCAL_DEV', true );
include( dirname( __FILE__ ) . '/local-config.php' );
} else {
define( 'WP_LOCAL_DEV', false );
define( 'DB_NAME', '%%DB_NAME%%' );
### Keybase proof
I hereby claim:
* I am alexwoollam on github.
* I am awool (https://keybase.io/awool) on keybase.
* I have a public key ASCB9laMpb0JT3Yt-SiieYKmTv7PMqX1IdPjNVN_oXPALQo
To claim this, I am signing this object: