How-to inspect filter-able $vars?

Example Nav menu walker – allows adding eg. css classes to (all) menu items. // copyied from /wp-core/wp-includes/nav-menu-template.php > line 76 (wp 3.1.1) – start_el() function $class_names = join( ‘ ‘, apply_filters( ‘nav_menu_css_class’, array_filter( $classes ), $item, $args ) ); Now let’s check the $var: function wpse15319_check_nav_menu_classes( $classes ) { // You can take any … Read more

TinyMCE style_select – Append Classes

EDIT The quick and easy method is just a simple setting: style_formats_merge… function myformatTinyMCE($in) { $style_formats = array( array( ‘title’ => ‘Classes’, ‘items’ => array( array( ‘title’ => ‘Blue Color’, ‘selector’ => ‘p,strong,u,em,ol,ul’, ‘classes’ => ‘blueColor’ ) ) ) ); $in[‘style_formats_merge’] = true; $in[‘style_formats’] = json_encode( $style_formats ); return $in; } add_filter(‘tiny_mce_before_init’, ‘myformatTinyMCE’ ); Everything … Read more

Automatically wrap post image in div

It’s the image_send_to_editor filter: if(is_admin()){ add_filter(‘image_send_to_editor’, ‘wrap_my_div’, 10, 8); function wrap_my_div($html, $id, $caption, $title, $align, $url, $size, $alt){ return ‘<div class=”mydiv” id=”mydiv-‘.$id.'”>’.$html.'</div>’; } } For existing images/posts you can try the regex in the function below

WordPress in “Couch Mode”?

Here’s a method to achieve what you want internally without adding anything to the .htaccess file. It works by adding a rewrite endpoint named read, so any single post permalink with read appended to the end will have a different single post template applied. For example, if your normal single post permalink is: localhost/techylab/some-post-title/ The … Read more

Any Hook Called When Post Becomes Published?

Every time a post changes status, wp_transition_post_status function will be called. This triggers the actions ${old_status}_to_${new_status} and ${new_status}_${post->post_type}, so for example publish_post will be triggered here. A post with a date in the future will have the status future until it is actually published, so this should work for you.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)