Web Design Weekly #192

Headlines Interoperable CSS Writing CSS isn’t easy, especially at a large scale. Thankfully we have Glen Maddern and a few other super smart people exploring how we might author CSS in the not too distant future. (glenmaddern.com) Practical Questions around Web Components Ian Feather investigates some of the more practical questions and issues still remaining for Web Components today. (ianfeather.co.uk) Sponsor Web Design Weekly and reach over 23,000 Designs & Developers Articles What is WebAssembly? If you were a little confused by the announcement of WebAssembly by Brendan Eich like…

Replace existing pages with new pages, keep menu links

I basically want a plugin or method that would give the same functionality as ‘Enable Media Replace’ but for replacing pages and posts, instead of redirecting, or manually editing. I’ve searched high and low and while I’ve found similar, or workarounds, or manual editing of DB, these weren’t ideal, or beyond my abilities. I’m redesigning an existing WP site, have changed template and have added many new pages, with multiple template level customisations (on >20 pgs), but want to keep the existing (google indexed) links throughout intact – and not…

Display Data From This Custom Media Upload Meta Box?

This plugin is working without any issue on CMS. Now I need to know how to properly display them in my post. Custom Media Upload Meta Box Plugin. $meta_box_media_upload = new Meta_Box_Media_Upload(); class Meta_Box_Media_Upload { function __construct() { add_action( ‘add_meta_boxes’, array( $this, ‘setup_box’ ) ); add_action( ‘save_post’, array( $this, ‘save_box’ ), 10, 2 ); } function setup_box() { add_meta_box( ‘meta_box_id’, __( ‘Meta Box Media Upload’, ‘some-meta-box’ ), array( $this, ‘meta_box_contents’ ), ‘post’, ‘side’ ); } function meta_box_contents() { wp_enqueue_media(); wp_enqueue_script( ‘meta-box-media’, plugins_url(‘js/media.js’, __FILE__ ), array(‘jquery’) ); wp_nonce_field( ‘nonce_action’, ‘nonce_name’ );…

Translating custom post type metaboxes

Is it possible to translate custom post type metaboxes (label not values of metaboxes fields) with localization? Or do I have to use some plugin like WPML? Thank you in advance. I have read this Custom metabox translation but I tried with Codestyling Localization and it didn’t work so I am not sure if it is possible to translate those labels. Edit: I pass the array of metaboxes to the constructor: array( ‘id’ => ‘rti-meta-box-1’, ‘title’ => __(‘Title Options’,’rti’), ‘pages’ => array(‘post’, ‘page’, ‘courses’), ‘context’ => ‘advanced’, ‘priority’ => ‘default’,…

Menu location by menu id or menu ID in start_el() Walker

I’m creating a custom walker menu where I’m adding custom fields to the menu items, but I would like the fields to be specific to menu locations. I can get all the menu locations with the menu ID’s assigned to them from: $menu_locations = get_nav_menu_locations(); This outputs an array like: array:2 [ « main_nav » => 27 « footer_nav » => 29 ] Or you can get all the menus but they don’t have the theme locations with: $menus = get_terms(‘nav_menu’); This outputs an an object list like: array:3 [ 0 => {#762 + »term_id »:…

current_user_can( ‘edit_post’, $post_id ) does not work for contributer but for administrator

I have a custom post type named project which has ‘capability_type’ => ‘post’ while registering using register_post_type. In my theme files and also functions.php file, I have situations where I should check if the project to be edited is authored by the user or not. So I use this: if ( !current_user_can( ‘edit_post’, $porject_id ) ) return; where $project_id is post id of the project to be edited. For example I have a page template named single_project.php where I can show single posts in project post type to users and…

Web Design Weekly #191

Headlines What is Code? This article by Paul Ford is epic. If you haven’t had time, or it is on your ‘read later’ list, now is the time to brew up a big coffee and enjoy it. (bloomberg.com) You know how to code, but how are your UI/UX design skills? Do you ever wish your websites & apps looked more “professional”? Take one of our online UI/UX design courses with hands-on projects & 1-on-1 mentoring from expert designers — we guarantee you’ll see an improvement in your work. Sign up…

Modify footer text in WordPress Admin area

If you happen to develop sites for your clients in WordPress it is worth taking a few extra steps to customise the WordPress admin. Thankfully WordPress comes with lots of built in hooks to make this super easy. With a fresh install, you will be greeted with the following footer text in the footer admin: Thank you for creating with WordPress. To adjust this text, add the following snippet in your functions.php file. function modify_footer_admin () { echo ‘Site developed by <a href= »https://s12621.p20.sites.pressdns.com »>Web Design Weekly</a>. Powered by <a href= »http://www.wordpress.org »>WordPress</a>’; }…