Web Design Weekly #205

Headlines Ad Blocking and the Future of the Web So much “#HotDrama” around this topic over that last couple of weeks. Jeffrey Zeldman sums things up quite well but if you are looking for more then Sam Snelling’s and Seth Godin’s articles are also worth reading. (zeldman.com) NGINX Open Source 1.9.5 Released with HTTP/2 Support (nginx.com) Reissue of the 1975 NASA Graphics Standards Manual, now on Kickstarter The NASA Graphics Standards Manual reissue is available on Kickstarter. Designed by Richard Danne and Bruce Blackburn in 1974, and rescinded by NASA in…

add_rewrite_rule doesn’t work for me

I’m trying to use add_rewrite_rule to make custom URL. My problem is the same as here : Custom Rewrite with Query vars But I tried the 2 solutions, and it doesn’t work for me. For testing, I installed locally a new version of wordpress with default theme Twenty fifteen. I installed the plugin Rewrite rules Inspector to see all the active rules. I added a page « test » and added this function in function.php : add_filter( ‘query_vars’, ‘query_vars’ ); function query_vars( $vars ) { array_push($vars, ‘information’); return $vars; } add_action( ‘rewrite_rules_array’,…

Use not custom fields in get_posts() meta_query?

Is it possible to use not custom fields in get_posts()‘s ‘meta_query’ to use a or-relation statement with a custom field and a category id? Like this: $args = array( ‘posts_per_page’ => 6 , ‘offset’ => 0 , ‘meta_query’ => array( ‘relation’ => ‘OR’ , array( ‘key’ => ‘placing’ , ‘value’ => ‘nn’ ) , array( ‘key’ => ‘category_id’ , ‘value’ => $cat->term_id ) ) ); $myposts = get_posts($args); And if so, should it be term_id or category_id? Or how do I accomplish that? Source: https://wordpress.stackexchange.com/feeds

How to remove anchor of current menu item in navbar?

WordPress nav menu created by wp_nav_menu can highlight current menu item. How can i strip anchor from current menu item? For example, we have menu: <ul> <li class= »current-menu-item »><a href= »/somelink »>Home</a></li> <li><a href= »/elselink »>Item</a></li> … </ul> Can we remove <a href= »/somelink »> and leave just « Home » if it is current page? UPD. In my functions.php I have a walker like this: class My_Walker_Nav_Menu extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat(« t », $depth); $output .= « n$indent<ul class= »dropdown-menu »>n »; } } and I’ve found the walker I need: //Creating new walker class, which won’t make…

Web Design Weekly #204

Headlines Two Months With CSS Modules CSS Module are still a relatively new concept in the front-end space but people are slowly taking the leap and pushing it to production. In this post Chris Pearce explains how his team at Lystable are reaping the rewards from diving in head first. (chrispearce.co) Sponsor WDW and Reach Over 23,648 Developers Articles Building an Enterprise CSS Framework A behind the scenes look at the ins and outs of building a large enterprise CSS framework by Stephanie Rewis. If you happen to be working…

WP REST API Access-Control-Allow-Origin response is cached

I have an AngularJS site that is pulling in posts from WordPress via the plugin « WP REST API (WP API) ». I am testing a site on both dev and staging subdomains, and the WP API works on both. However, when I visit one domain, and then switch over to another domain immediately afterward, then the dynamically-generated Access-Control-Allow-Origin is « stuck » on the previous domain to make the API calls. It’s not until I refresh the page, that the response header updates to the current domain making the request. Here is what…

get_next_post_link() and get_previous_post_link() return wrong posts

I’m using get_next_post_link() and get_previous_post_link() within the loop but the returned posts are not correct. get_next_post_link() shows the previous post and get_previous_post_link() gives the current post. Below the context of these links: $args[‘name’] = $postname; $query = new WP_Query($args); if($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $id = get_the_ID(); $title = get_the_title(); $content = get_the_content(); $nextpost = get_next_post_link(‘Next: %link’); $previouspost = get_previous_post_link(‘Prev: %link’); } } Source: https://wordpress.stackexchange.com/feeds

wp_schedule_single_event does not call my action

I have created the following action: add_action( ‘test_action’, ‘test_action’ ); function test_action() { error_log( ‘test_action’ ); } And am calling it like this: error_log( ‘send_test_email_in_background:START’ ); wp_schedule_single_event( time(), ‘test_action’ ); error_log( ‘send_test_email_in_background:END’ ); What I receive in the apache error log file is this: [17-Sep-2015 11:09:35 UTC] send_test_email_in_background:START [17-Sep-2015 11:09:35 UTC] send_test_email_in_background:END This works exactly the same in development on my Windows PC (running WAMP) than it is on Production (running Linux in AWS). Also, if I schedule the single event 5 minutes in the future (time() + 300) it…

Refresh page after update_post_meta

I have created a input field on a front-page where the value of the database is on the same page as the input-field. If a value is passed to the database I have to reload the page for it to show on the page. Is there a way where I can automatically refresh the page after the value is passed to the database, so it is shows instantly? My guess would be JQuery but I don’t know how! M. Source: https://wordpress.stackexchange.com/feeds