Front end submit form with jquery form plugin

Leave the action value as blank. Give the submit button a name as name=”form_sub”. Then add the following code to your functions.php file. Check the codex for init hook. You can create a ‘Thank You’ page, or a confirmation page where the user should go after successful submission. <?php add_action(‘init’, ‘form_submit’); function form_submit(){ if(isset($_POST[‘form_sub’])) { … Read more

sql query to put quotes around numbers in img tag

You are simply going to love this one First of all, here is a sample table with data loaded: mysql> use junk Database changed mysql> drop table todd; Query OK, 0 rows affected (0.01 sec) mysql> create table todd (id int not null auto_increment,url VARCHAR(255), -> primary key (id)) ENGINE=MyISAM; Query OK, 0 rows affected … Read more

WordPress Wysiwyg Content not being displayed

To expand on what @fischi said, first step to troubleshooting is switch to the default theme (twentyeleven) and disable all plugins. If your content shows up, turn plugins back on one by one until you either find the offending plugin or they’re all on. If you get them all back on and the content still … Read more

Appending meta value onto post content in WordPress during save_post

The initial solution I’ve found is to tie a filter onto an action like wp_insert_post_data and extract other post information from the global $post object. // Tack our filter onto the wp_insert_post_data action add_filter( ‘wp_insert_post_data’, ‘my_appender’ ); function my_appender( $content ) { // Bring global $post into scope global $post; // Get meta value of … Read more

Filter link to existing content suggestion

Currently there are no ready filters available for this purpose. A ticket has been posted for the request.Lets hope we get one soon. Instead of hardcoding your custom post types its better to create a filter hook and use it Till then you can create your own filter. Open includes/class-wp-editor.php and make folowing changes at … Read more

Add a Custom Class to Admin Menus

The following does the job: add_action( ‘admin_init’,’wpse_60168_custom_menu_class’ ); function wpse_60168_custom_menu_class() { global $menu; foreach( $menu as $key => $value ) { if( ‘Posts’ == $value[0] ) $menu[$key][4] .= ” custom-class-1″; if( ‘Pages’ == $value[0] ) $menu[$key][4] .= ” custom-class-2″; } } And if you want to inspect what the $menu contains, use this: add_action( ‘admin_init’,’wpse_60168_var_dump_and_die’ … Read more

How can one utilize a variable as a callback function name for add_settings_field

Do not use different callbacks, use the the sixth parameter for add_settings_field() instead. That is an array, and you can pass any data to the callback here. Example: foreach( $theOptions as $k => $v ) { add_settings_field( $k, $v, ‘my_callback’, $the_options, $the_group, array ( ‘special’ => $k ) ); } function my_callback( $args ) { … Read more