Wrap a post image with a div if it doesn’t have a caption

You could try with 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) { if( isset($caption) && $caption ) return $html; else return ‘<div class=”mydiv” id=”mydiv-‘.$id.'”>’.$html.'</div>’; } }

How to make wp dropdown category load with selected option on top?

if the currently selected item has some type of identifier on it (maybe class=”current”) you may be able to use some jquery to grab it’s value, hide it, then move it to the top. <div class=”topdiv”> this is top div </div> <ul> <li>1</li> <li class=”current”>2</li> </ul> (function() { var top = $(‘.current’).html(); $(‘.current’).hide(); $(‘.topdiv’).text(top); })(); … Read more

Use specific language for comment section

On the bottom of comments.php I use the following code: <?php comment_form(array(‘comment_field’ => ‘<p class=”comment-form-comment”><label for=”comment”>Comment</label><textarea id=”comment” name=”comment” cols=”45″ rows=”8″ aria-required=”true”></textarea></p>’, ‘comment_notes_before’ => ‘<p class=”comment-notes”>Your email address will not be published. Required fields are marked *</p>’, ‘comment_notes_after’ => ”, ‘title_reply’ => ‘Leave a Reply’, ‘title_reply_to’ => ‘Leave a Reply to %s’, ‘label_submit’ => ‘Post comment’, … Read more

Force resize for all video content

Without knowing more information – you can use CSS to set a max width to any element. iframe, object, embed { max-width:100%; } Rachel Baker mentioned Fitvids.JS in her WordCamp Chicago presentation last weekend. It is a Javascript plugin that writes specific code for the various video providers online. Try the CSS solution and fall … Read more

Show custom menu in category and its posts

Well it looks like you are using theme that doesn’t have custom menu supporting code inside post and category templates. Since it’s working fine in page template you should go to Appearance -> Editor and open for editing page.php or index.php and look for wp_nav_menu() with all it’s arguments. Select and copy and insert it … Read more