How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)

That caption shortcode is built into WordPress. It should generate the same markup for any theme, unless the theme or a plugin has unregistered it and registered a replacement. I don’t know if that is the case with your theme or with TwentyEleven. Look for ‘img_caption_shortcode’ in your theme files, probably functions.php. If your theme … Read more

If meta_value = ‘yes’, then add class?

The post_class filter is your friend. Just combine it with get_post_meta(). function wpse80098_filter_post_class( $classes ) { global $post; if ( ‘yes’ == get_post_meta( $post->ID, ‘_jsFeaturedPost’, true ) ) { $classes[] = ‘my-custom-css-class’; } return $classes; } add_filter( ‘post_class’, ‘wpse80098_filter_post_class’ ); Just replace my-custom-css-class with whatever class you want to apply to the post container in … Read more

How do I access the media settings

The sizes are stored in the options table in the database, so you can grab values with get_option(‘large_size_w’); The values stored in the DB are: thumbnail_size_w thumbnail_size_h medium_size_w medium_size_h large_size_w large_size_h

Word Count Function Preventing Permalink Editing

I put the script in a external file // Excerpt word count function excerpt_count_js(){ wp_enqueue_script( ‘excerpt-word-count’, plugins_url( ‘excerpt_word_count.js’, __FILE__ ), array( ‘jquery’ ), false, true ); } And modified the script a bit jQuery(document).ready( function($){ $(“#postexcerpt .handlediv”) .after(“<div style=\”position:absolute;top:2px;right:5px;color:#666;\”><small>Excerpt length: </small><input type=\”text\” value=\”0\” maxlength=\”3\” size=\”3\” id=\”excerpt_counter\” readonly=\”\” style=\”background:#fff;\”> <small>word(s).</small></div>”); $(“#excerpt_counter”).val($(“#excerpt”).val().split(/\S+\b[\s,\.\’-:;]*/).length – 1); $(“#excerpt”).keyup( function() { … Read more

wp nav menu: add attributes to menu items [duplicate]

You can use a Custom Walker to add attributes to the menu items. Basically, you add a parameter ‘walker’ to the wp_nav_menu() options and call an instance of an enhanced class: wp_nav_menu( array ( ‘menu’ => ‘main-menu’, ‘container’ => FALSE, ‘container_id’ => FALSE, ‘menu_class’ => ”, ‘menu_id’ => FALSE, ‘depth’ => 1, ‘walker’ => new … Read more

Stumped – Ajax Response Returns 0

Debug it logically. This code works. I just tested it. This in a theme (I put it in header.php for testing): jQuery(document).ready(function() { var lanid = ‘demo’; var ajaxurl=”<?php echo admin_url(“admin-ajax.php”, null); ?>”; data = { action: “get_ldapattr”, lanid: lanid}; jQuery.ajax({ url: ajaxurl, data: data, dataType: ‘json’, type: ‘post’, success: function(response) { console.log(response); } }); … Read more

Why is this Ajax not working?

When you load a php file directly via an ajax request (UncheckPackageThemeHelper.php) it’s loaded outside the context of WordPress, so no WordPress core functions are available. All WordPress ajax requests should be routed through admin-ajax.php. You can print the URL with the function admin_url: admin_url( ‘admin-ajax.php’ ) When admin-ajax.php is loaded, WordPress is bootstrapped, so … Read more