How do I setup nested repeatable option fields?

Not a direct answer to your specific case but this will probably help you figure out how to do it. I found an article here: http://www.sutanaryan.com/jquery-duplicate-fields-form-submit-with-php/ which details the process of posting fields which can be repeated using jQuery. In his example he creates an HTML form: <form action=”process.php” method=”post”> <p class=”clone”> <label> Name: </label> … Read more

Get data from dropdown and update page

How about this: <?php $arr = [“Cat”, “Dog”, “Cow” ]; if( $_POST[‘animal’]){ $animal=$_POST[‘animal’]; echo $animal; } ?> <form name=”f” id=”a” method=”post” action=””> <select id=”animal” name=”animal” onchange=”this.form.submit()” > <option value=”0″>–Select Animal–</option> <?php foreach ($arr as $a){ if($a == $animal){ echo “<option value=”{$a}” selected >$a</option>”; }else{ echo “<option value=”{$a}” >$a</option>”; } } ?> </select> </form> Note you … Read more

Sanitizing comments or escaping comment_text()

After thinking about this a little bit, I guess that the proper way to ensure that your comments are properly escaped, is by doing something like this: $the_comment = get_comment_text(); echo ‘<p>’ . esc_html($the_comment) . ‘</p>’; Instead of simply using the function like this: comment_text(); Why even have these handy functions in the first place, … Read more

How to replace a javascript select box onchange event to a form submit action?

It’s not working because: You are redirecting home You don’t listen for the $_GET variable so the archive link is just appended to your home url You need to add a function that listens for that $_GET variable. just add this to your functions.php file add_action( ‘template_redirect’, ‘wpse_archive_select’ ); function wpse_archive_select(){ if( isset( $_GET[ ‘archive-dropdown’ … Read more

Add input field to ‘Pages > Edit Page’ through functions.php

functions.php // Add custom Slider ID field to ‘Edit Page’ add_action( ‘add_meta_boxes’, ‘cd_meta_box_add’ ); function cd_meta_box_add() { add_meta_box( ‘my-meta-box-id’, ‘Slider’, ‘cd_meta_box_cb’, ‘page’, ‘normal’, ‘high’ ); } function cd_meta_box_cb( $post ) { $values = get_post_custom( $post->ID ); $text = isset( $values[‘my_meta_box_text’] ) ? esc_attr( $values[‘my_meta_box_text’][0] ) : ”; wp_nonce_field( ‘my_meta_box_nonce’, ‘meta_box_nonce’ ); ?> <p> <label for=”my_meta_box_text”>Add … Read more

Quicktags on all textarea.. Not working on plugin?

it you’re not seeing the buttons, try to call QTags._buttonsInit(); right after you call the quicktags( settings ); function. quicktags(settings); QTags._buttonsInit(); Following also works for me qt_editor = new QTags( { ‘id’: ‘my_editor’, ‘buttons’: ‘strong,em,link’ } ); QTags._buttonsInit(); Also, it seems that adding a button via QTags.addButton() function also makes your toolbar to display qt_editor … Read more