Skip to content

Instantly share code, notes, and snippets.

View philbirnie's full-sized avatar

Phil Birnie philbirnie

View GitHub Profile
@philbirnie
philbirnie / cms.xml
Last active December 11, 2015 12:08
An example of how to properly add additional links in Magento
<layout version="0.1.0">
<default>
<reference name="top.links">
<action method="addLink" translate="label title" module="page">
<label>About</label>
<url>about-us</url>
<prepare>true</prepare> <!-- This is necessary if we are going to add the base URL -->
<title>About</title>
<urlParams />
<position>90</position>
@philbirnie
philbirnie / Instructions
Last active January 17, 2023 20:40
Steps to Combine Wordpress and Codeigniter when CI is in a subdirectory of Wordpress
Instructions
1. Add MY_url_helper.php to CI_directory/application/helpers
2. If the CI app is already built, convert any references to *site_url* in your CI application (aside from the system directory) to the new namespaced function, ci_site_url.
This step prevents Wordpress' site_url function from overwriting CIs. Because both functions are global and CI checks to make sure that site_url has not been set. Once we load the WP bootstrap file, it will have been defined, so CI's function wll never load.
3. Add Wordpress' bootstrap file into CI_directory/index.php right above CI's bootstrap file.
4. Update wp-includes/load.php *(this is necessary if you are using CI's sessions - Wordpress mangles CI's cookies using with magic quotes. (There may be an upgrade-proof way to do this.)
@philbirnie
philbirnie / page.php
Last active December 13, 2015 21:38
Password protect custom field types in Wordpress when visibility is set to "Password Protected"
<?php
//This function evaluates TRUE if the post is not password protected OR the correct password has been supplied.
if ( !post_password_required())
{
//Whatever Custom Field(s) you wish to protect
the_field("page_content");
}
else
{
//This will call the password form -- can be customized in functions.php
@philbirnie
philbirnie / font-size.less
Last active December 14, 2015 21:49
Mixin for REM font-size
/** Font Size is in REMs,margins are mutiples of the base value
Line height is automatically set based upon the font size */
.font-size(@sizeValue, @margin-bottom: 0, @margin-top: 0)
{
@base: 2.2;
@remValue: @sizeValue;
@pxValue: (@sizeValue * 10);
@lineHeightRem: ceil(@sizeValue / @base)*@base;
@lineHeightPx: (@lineHeightRem * 10);
@marginTopRem: (@margin-top * @base);
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Adept_Catlanding>
<active>true</active>
<codePool>local</codePool>
</Adept_Catlanding>
</modules>
</config>
@philbirnie
philbirnie / config.xml
Last active August 29, 2015 13:55
Adept_Catlanding Congifuragion
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Adept_Catlanding>
<!-- Make sure that the version number matches the filename on your install script! -->
<version>0.3.0</version>
</Adept_Catlanding>
</modules>
<global>
<resources>
@philbirnie
philbirnie / mysql4-install-0.3.0.php
Created January 30, 2014 16:13
Installation file for custom category field
<?php
$installer = $this;
$installer->startSetup();
/**
* This is an entity associated with catalog_category
* @var integer
*/
$entityTypeId = $installer->getEntityTypeId('catalog_category');
@philbirnie
philbirnie / tabs.js
Last active August 29, 2015 14:01
Barebones Tabs switcher
/*jslint browser: true*/
/*global jQuery */
/*---------------------------------------------------------------
* Barebones Tabs Class
*
* Requires jQuery
*
* Markup:
* - Tab elements should have class "tab" with a data-tabref="x"
@philbirnie
philbirnie / quickbrick.js
Created May 21, 2014 13:44
Dead simple position mover for an element or two to keep everything tidy
/*jslint browser: true*/
/*global jQuery */
var QuickBrick = {
topEntity: null,
bottomEntity: null,
@philbirnie
philbirnie / custom_post_demo.php
Last active August 29, 2015 14:07
Custom Post Boilerplate
<?php
/*
Plugin Name: BBB - Videos
Plugin Uri: URI
Description: Custom Field Type Video
Author: Phil Birnie
Version 0.9
Author Uri: http://mindstreaminteractive.com
*/