Displaying Saved Meta Box Data in Drop Down with selected()

<?php selected() ?> compares the value of the stored data and which option should appear first, my error was that I wasn’t storing the variable to compare it to correctly. $selected = isset( $values[‘location’] ) ? esc_attr( $values[‘location’][0] ) : ”; should be changed to: $selected = isset( $custom[‘location’] ) ? esc_attr( $custom[‘location’][0] ) : … Read more

How to Populate the list of custom post type categories

The second param fort historia function is deprecated, so it would be much nicer to pass params as an array: $terms = get_terms( array( ‘taxonomy’ => ‘vcategory’, ‘hide_empty’ => false, ) ); But if you want to show a select filled with terms of given taxonomy, there’s a function for that: wp_dropdown_categories( array( ‘show_option_all’ => … Read more

How to Append to the_excerpt() Function

function custom_excerpt_more( $more ) { return ‘…’; // <– your end string } add_filter( ‘excerpt_more’, ‘custom_excerpt_more’ ); http://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_more The above solution is the preferred, but to make this work: <p class=”extra”><?php the_excerpt() . $more; ?></p> Change it to: <p class=”extra”><?php the_excerpt(); echo $more; ?></p>

How to get any tag ID

In your admin, go to Posts > Tags and then click edit for the tag you’re after – the URL in your browser address bar will look like: http://example.com/wp-admin/edit-tags.php?action=edit&taxonomy=post_tag&tag_ID=X&post_type=post See the part where tag_ID=X – that X is your tag ID.

Two different menus for two different locations?

You most probably used the theme location part wrongly. Here is an example of how it should be done Follow the comments in code for explanation 🙂 add_filter( ‘wp_nav_menu_args’, function ( $args ) { if ( is_page( 2 ) //Only target page 2 && $args[‘theme_location’] === ‘primary’ ) { // Check and only target the … Read more