Skip to content

Instantly share code, notes, and snippets.

<?php
$meta_value = rwmb_meta('leven_base_text_box');
echo do_shortcode($meta_value);
?>
@clare485
clare485 / custom taxonomy - if is in custom category show this
Created August 29, 2013 10:30
custom taxonomy - if is in custom category show this 'float-components' is the slug of the product category, 'products' is the name of the taxonomy - which in this case was added in the functions.php
<?php if (has_term('float-components', 'products')) { ?>
put content here
<?php } ?>
/*
* custom taxonomies - add this to functions.php
*/
function build_taxonomies() {
<?php
$fromtype = get_post_meta(get_the_ID(), 'leven_from_type', true);
if ($fromtype):
?>
<?php echo get_post_meta(get_the_ID(), 'leven_from_type', true); ?>
<?php endif; ?>
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
@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' )); ?>
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 / 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());
});