Tag: wpalchemy

MSDLAB Toolkit

This is what I use for most of my WordPress Sites. The GitHub repository has most of the custom stuff that I use over and over. Generally speaking, I simply customize as needed per client. Not the “properest” way to do it, but faster and more cost effective for the client. Sometimes I do a major update when I find myself doing very similar customizations over and over.

Themes

Genesis Framework

Mad Science themes are built as child themes for the Genesis framework by StudioPress. Genesis themes work differently from other WordPress themes, because they rely strongly on hooks and actions. These two important keywords can take a bit of fiddling with to wrap your head around, but they are built into every part of WordPress, and once you understand them, they make it very simple to customize layout, activity, and even functionality of a WordPress site.

There are some nice reference sites for Genesis. I find myself going back to the visual hook guide frequently, as well as other areas of Genesis Tutorials.

You will need to install the Genesis theme on any site that you will be installing a genesis child theme.

MSDLAB Starter Theme

A Genesis starter theme with Twitter Bootstrap & Font Awesome support using LESS. On GitHub. Copy and rename to use.

Plugins

Premium Plugins

Custom Plugins

The GitHub repository has a number of customized plugins. The one that is used on almost every site I do is MSD Site Settings. The others are mostly customizations of existing plugins. As I have time I am making them into “child plugins” so that they don’t need to be updated every time a source plugin is updated.

Plugin Directory Plugins

Can be found as favorites under my username, Foxydot. I don’t use all of these on every site, obviously, but these are ones I use often and trust.

Tools

The one tool I rely on quite a bit is WPAlchemy. There is a copy in the GitHub repository, at the WP_CONTENT_DIR level, because that’s where my plugins and themes call it from. You can place it anywhere you like, and there are probably old copies in my plugins too. Yes, you can do all of this the Tadlock Way (and the Tadlock Way is usually the right way), but I find WPAlchemy to be a small overhead price to pay for ease of use and function.

WPAlchemy repeating fileds and the wp_editor()

I may have something working. I’m still doing some testing, but I think the problem lies here:
” $editor_id (string) (required) HTML id attribute value for the textarea and TinyMCE. (may only contain lower-case letters)” (http://codex.wordpress.org/Function_Reference/wp_editor)

When you try to pass $mb->get_the_name(), it inputs all kinds of brackets and such, which are disallowed characters. Here’s where I’m at:

https://gist.github.com/foxydot/9075575.js

Using sanitize_key removes those illegal characters. Adding ‘textarea_name’=>$mb->get_the_name() to the settings array re-targets the input to that hidden textbox.

I’m using Extract Mode (I always do, for searchability) and so far it seems to be working.

Move meta box above editor

add_action('admin_footer','subtitle_footer_hook');
function subtitle_footer_hook()
{
	?><script type="text/javascript">
	jQuery('#titlediv').after(jQuery('#_speaker_title_metabox'));
	jQuery('#_speaker_title_metabox').after(jQuery('#_speakers_metabox'));
	</script><?php
}

WPAlchemy Data Storage Modes

Be careful to do this to make data searchable. Out of the box WPAlchemy uses WPALCHEMY_MODE_ARRAY which is not very useful for meta searches!

$custom_metabox = new WPAlchemy_MetaBox(array
(
    'id' => '_custom_meta',
    'title' => 'My Custom Meta',
    'template' => TEMPLATEPATH . '/custom/meta.php',
    'mode' => WPALCHEMY_MODE_EXTRACT,
    'prefix' => '_my_'
));

If you forget, use this:

    if ( ! function_exists( 'msd_convert_storage' ) ) :
            function msd_convert_storage($key,$prefix,$posttype) {
                    $args = array(
                        'numberposts'     => -1,
                        'post_type'       => $posttype,
                    );
                    $items = get_posts($args);
                    foreach($items AS $item){
                            $the_meta = get_post_meta($item->ID,$key);
                            $fields = array();
                            foreach($the_meta[0] AS $meta_key => $meta_value){
                                    $meta_key = $prefix.$meta_key;
                                    update_post_meta($item->ID, $meta_key, $meta_value);
                                    $fields[] = $meta_key;
                            }
                            update_post_meta($item->ID,$key.'_fields',$fields);
                            delete_post_meta($item->ID,$key);
                    }
            }
    endif;