Add a Second Menu to a theme that only support 1 menu

Adding custom menu position to your wordpress theme is fairly simple. This is usually done this way: 1. Announcing the desired menu positions (in function.php): add_action( ‘init’, ‘register_my_menus’ ); function register_my_menus() { register_nav_menus( array( ‘first-menu’ => __( ‘First Menu’ ), ‘second-menu’ => __( ‘Second Menu’ ), ‘third-menu’ => __( ‘Third Menu’ ) ) ); } … Read more

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

Custom Post Type Taxonomies -Posts not showing in Category or Tag pages

You were close with the code you posted in your comment. The issue is that you only tested for is_main_query, which will limit every query on your site to that single post type. function wpa82763_custom_type_in_categories( $query ) { if ( $query->is_main_query() && ( $query->is_category() || $query->is_tag() ) ) { $query->set( ‘post_type’, array( ‘post’, ‘resource’ ) … 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