online bilježnica

Exclude empty terms from menus

Exclude empty terms from menus

Dynamically exclude empty terms from nav menus Treba dodati u functions.php: add_filter( ‘wp_get_nav_menu_items’, ‘gowp_nav_remove_empty_terms’, 10, 3 ); function gowp_nav_remove_empty_terms ( $items, $menu, $args ) { global $wpdb; $empty = $wpdb->get_col( “SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE count = 0” ); foreach ( $items as $key => $item ) { if ( ( ‘taxonomy’ == $item->type ) […]

Resize fotografija

Resize fotografija

https://code.tutsplus.com/tutorials/using-custom-image-sizes-in-your-theme-and-resizing-existing-images–wp-24815 add_action( ‘after_setup_theme’, ‘setup’ ); function setup() { // … add_theme_support( ‘post-thumbnails’ ); // This feature enables post-thumbnail support for a theme add_image_size( ‘header’, 600, 200, true ); // header image add_image_size( ‘custom-size1’, 400, 200 ); // 400 pixel wide and 200 pixel tall, resized proportionally add_image_size( ‘custom-size2’, 400, 200, true ); // 400 pixel […]