Force PDF download from custom menu?

If you don’t mind all PDF attachments been forced to be downloaded then you can use something like this: <?php if (have_posts()) : while (have_posts()) : the_post(); $pdf_title = $post->post_title; $uploads_dir = wp_upload_dir(); $attachment_src = get_post_meta( $post->ID, ‘_wp_attached_file’, true ); $pdf_src = path_join( $uploads_dir[‘basedir’], $attachment_src ); header(“Pragma: public”); // required header(“Expires: 0”); header(“Cache-Control: must-revalidate, post-check=0, … Read more

Remove Metabox from Menus screen

The box gets added in wp_nav_menu_setup(), so you’ll have to remove it sometime after that and before it’s being output later in nav-menus.php. There don’t seem to be any action hooks you can use there, but admin-header.php has a few. You could try this: add_action( ‘admin_head-nav-menus.php’, ‘roots_remove_nav_menu_metaboxes’ ); I’ve never tried removing metaboxes from the … Read more

Menu styling for last menu item

Here’s a function I use to add a first / last class to wp_nav_menu() items: function add_first_and_last($items) { $items[1]->classes[] = ‘first’; $items[count($items)]->classes[] = ‘last’; return $items; } add_filter(‘wp_nav_menu_objects’, ‘add_first_and_last’); Developer Resources – wp_nav_menu_objects Hook

Where is definied the theme location for the main menu in a WordPress template?

Menu locations are defined in functions.php You can read the codex for more information on how to define menu locations in functions.php Register Menus Firstly, in your theme’s functions.php, you need to write a function to register the names of your menus. (This is how they will appear in the Appearance -> Menus admin screen.) … Read more

get menu id using its name

You can use the function get_term_by and use ‘name’ in the field param. <?php get_term_by( $field, $value, $taxonomy, $output, $filter ) ?> Example: $term = get_term_by(‘name’, ‘Social Network’, ‘nav_menu’); $menu_id = $term->term_id; Here is the link to the codex page: http://codex.wordpress.org/Function_Reference/get_term_by Hope this helps.

WooCommerce dynamic menus

Suffusion supports WordPress nav menus. You’ll find these in Admin > Appearance > Menus. Simply add your product categories to the menu as children of the ‘Shop’ page. Assign the newly created menu to the “Navigation Bar Below Header” location. http://codex.wordpress.org/Appearance_Menus_Screen