Custom markup with wp_nav_menu based on pages

The only way that I could think to do this would be to add a filter to wp_nav_menu_items. Here is the code that I got to work (just add it to your themes functions.php file): add_filter(‘wp_nav_menu_items’, ‘my_id_name_nav’, 10, 2); function my_id_name_nav($items,$args) { if( $args->theme_location == ‘primary’ ) { preg_match_all(‘/<li id=”menu-item-([0-9]+)”([^>]+)>\s*<a href=”https://wordpress.stackexchange.com/questions/13867/([^”]+)”>([^<]+)<\/a><\/li>/i’, $items, $matches); $newItems = … Read more

How to add a user defined hyperlink to the “Featured Image” and the_post_thumbnail()

I assume you want this to be output inside of the_content()? You would probably have to define a shortcode that will output the_post_thumbnail(). You could either define the shortcode to accept a URL as an argument, or else wrap the shortcode with HTML anchor tags. EDIT: Assuming you’re already outputting the_post_thumbnail() inside of the_content(), you … Read more

Installing WordPress locally

If the other answers make sense I apologise for how patronising my answer must sound – but if they don’t make sense perhaps my N00B style answer will 🙂 You can’t mess up the installation of wordpress on your live server if you are simply developing a theme on the localhost installation (a skin is … Read more

Query & Order posts by custom fields

You need to use the meta_query parameter of the WP_Class when running a query. Something like this should point you in the right direction. $data = date(“Y-m-d”); $args = array( ‘post_type’ => ‘jogos’, ‘meta_query’ => array( array( ‘key’ => ‘data_de_lancamento’, ‘value’ => $data, ‘compare’ => ‘<=’ ) ), ‘meta_key’ => ‘views’, ‘orderby’ => ‘meta_value’, ‘order’ … Read more

How to make the excerpt_more filter apply to the actual post excerpt?

I’m going to assume that you’re calling get_blog_excerpt() in your template somewhere? If so, what happens if you simply call the_excerpt(), and then pull the two add_filter() calls out of the container function? i.e. functions.php would just look like: function ce4_excerpt_length($length) { return 150; } add_filter(‘excerpt_length’, ‘ce4_excerpt_length’); function ce4_excerpt_more($more) { global $post; return ‘…<a href=”‘. … Read more