Skip to content

Instantly share code, notes, and snippets.

<?php
/* Remove Parent Theme Foundation Files */
wp_deregister_style("foundation-app");
wp_deregister_script("foundation-reveal");
wp_deregister_script("foundation-orbit");
wp_deregister_script("foundation-custom-forms");
wp_deregister_script("foundation-placeholder");
wp_deregister_script("foundation-tooltips");
wp_deregister_script("foundation-app");
wp_deregister_script("foundation-off-canvas");
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
@clare485
clare485 / placeholder in input for mailchimp widget
Created June 11, 2013 10:19
placeholder in input for mailchimp widget
//add placeholder for subscribe form
$(".mc_input").focus(function(){
showEmptyLabels();
$(this).siblings("label").stop().fadeOut();
});
$(".mc_input").blur(function(){
showEmptyLabels();
});
$(".mc_merge_var label").bind("click", function() {
$(this).siblings("div").find("input, textarea").focus();
@clare485
clare485 / new_gist_file
Created June 13, 2013 09:18
theme options examples
// Test data
$test_array = array(
'one' => __('One', 'options_framework_theme'),
'two' => __('Two', 'options_framework_theme'),
'three' => __('Three', 'options_framework_theme'),
'four' => __('Four', 'options_framework_theme'),
'five' => __('Five', 'options_framework_theme')
);
// Multicheck Array
@clare485
clare485 / wordpress cheatsheet - commonly used code.php
Created July 18, 2013 14:15
wordpress cheatsheet - commonly used code
<?php echo get_site_url(); ?>
<?php echo get_stylesheet_directory_uri(); ?>
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/image-brochure.png" alt=""/>
@clare485
clare485 / local-config.php
Created July 26, 2013 16:01
local-config.php
<?php
define('DB_NAME', 'hillmath');
/** MySQL database username */
define('DB_USER', 'firstfound');
/** MySQL database password */
define('DB_PASSWORD', 'firstfound');
/** MySQL hostname */
define('DB_HOST', 'wiki.firstfound.local');
/** Database Charset to use in creating database tables. */
@clare485
clare485 / jquery add classname to div
Created August 9, 2013 16:08
jquery add classname to div
//Add classname to attribute exclusive
$(".attribute-exclusive").each(function () {
var self = $(this);
self.addClass(self.text());
});
If Page Is Parent or Child Last updated on: SEPTEMBER 11, 2009 There are built in conditional WordPress functions for testing for a page: if ( is_page(2) ) { // stuff } Or for testing if a page is a child of a certain page: if ( $post->post_parent == '2' ) { // stuff } But there is no built in function that combines these two things, which is a fairly common need. For example, loading a special CSS page for a whole "branch" of content. Like a "videos" page and all its children individual videos pages. This function (add to functions.php file) creates new logical function to be used in this way: function is_tree($pid) { // $pid = The ID of the page we're looking for pages underneath global $post; // load details about this page if(is_page()&&($post->post_parent==$pid||is_page($pid))) return true; // we're at the page or at a sub page else return false; // we're elsewhere }; Usage if (is_tree(2)) { // stuff }
@clare485
clare485 / meta box with shortcode
Created August 14, 2013 14:27
Get shortcodes to work with meta boxes - eg a wordpress gallery
<?php echo do_shortcode(rwmb_meta( 'leven_full_width' )); ?>
Easy Fix for WordPress 3.5 ‘jQuery is not defined’ Error December 21st, 2012 | By: Jean Galea | 17 Responses On some of my blogs I encountered issues when upgrading to WordPress 3.5. The first indicator that something was amiss was the fact that the editor was not working properly in the admin. I couldn’t even click on the content pane to add or edit content. Hovering my mouse over the left side dashboard menu I noticed that the submenus where not displaying on hover, a clear indication that something Javascript related was awry. Sure enough, when I opened the console I found a few ‘jQuery is not defined’ errors. Some Google searches later and the solution was easy enough. It appears that the new version of WordPress has some new performance optimisation features that concatenate all JavaScript resources into a single request. While in itself that is a good thing, the bad thing is that it was creating the problem on some installs. The solution is easy, just open up your wp-config.php file and insert the