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

How can I make the “Preview Post” button save and preview in the same window?

Here’s a way to do it without modifying the core: add_action(‘admin_footer’,’preview_same_window’); function preview_same_window(){ ?> <script type=”text/javascript”> jQuery(function($){ jQuery(‘.preview.button’).unbind().removeAttr(‘target’); setTimeout(function(){ jQuery(‘.preview.button’).unbind().removeAttr(‘target’); },250); }); </script> <?php }

How to make Tag Aliases

Have not tested tested yet, but I see in the Codex page for wp_insert_term there’s one argument alias_of, which is described: There is no default, but if added, expected is the slug that the term will be an alias of. Expected to be a string. Maybe it helps πŸ˜‰

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

How to strip non-alphanumeric characters, convert spaces to dashes, uppercase to lowercase in this context

You could use sanitize_html_class() or sanitize_title_with_dashes(). Both functions do almost the same. But note that much more characters a valid in CSS class names. Examples: βœ‚ βœ‰ βœ”βœ½ ✾ ✿ ❀ ❉ ❀ ❦ β˜‚ β˜” ☎ ☘ β™« β™» βš₯ Update I recommend to encapsulate the code in a prefixed function to avoid collisions … 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