Missing current_page_item in custom menu

The current-item CSS class generated by wp_nav_menu() is .current-menu-item. However, wp_nav_menu() also has backward-compatibility with wp_page_menu()/wp_list_pages(), and does output .current_page_item (if the current context is a page post-type, of course). So, a couple of possibilities: The current context is not a static Page You’re using a custom walker for the wp_nav_menu() output, that doesn’t output … Read more

Importing specified data/field

So if I understood correctly, you’re make a site for a client, and already have a list of “books” you want to import. My suggestions : Create a custom post type for your books I think it’s the best approach, and it allows you to add any custom fields you want as meta fields. Look … Read more

Allow a subscriber to be an author and view only his post

You must write a small plugin for the Hook pre_get_posts; an example: add_action( ‘pre_get_posts’, ‘fb_allow_draft’ ); function fb_allow_draft( $query_obj ) { // only on admin screen use this filter if( ! is_admin() ) return; // change our query object to include any post status $query_obj->query_vars[‘post_status’] = ‘any’; } If you will specific this new loop … Read more

Translate custom template with WPML

To translate custom page templates you must select “Synchronize page template” in WPML options. For it to actually work the page template markup must be localized or internationalized using a recognized format, for example http://codex.wordpress.org/I18n_for_WordPress_Developers, and then have an accompanying .mo/.po file . WPML also has an addon called “String Translation module” which can scan … Read more

How to query term_id of a Custom Taxonomy by name

You can use the get_term_by function. This allows you to obtain a term (from a given taxonomy) by its slug or name (or id). The returned term object contains the term’s ID. For example: $term =get_term_by( ‘name’, ‘December-12’, ‘Birthday’); $term_id = $term->term_id; If ‘December-12’ is the slug, rather than the name, of the term, simply … Read more

Display Images with More Fields yes / no

Add a new “more field” radio button. For its value use *Show, Hide. The asterisk defaults to “Show”. PHP $value = get_post_meta($post->ID, ‘my_image’, true); if ( $value == ‘Show’ ) { echo ‘<img src=”https://wordpress.stackexchange.com/questions/49217/myimage.jpg”>’; }