Set parent theme language with custom .mo files

I am using Buttercream as my parent theme. I have translated the .mo file located in themesbuttercreamlanguages and saved it as nl_NL.mo and nl_NL.po. Now I want to display the parent theme in Dutch (nl_NL). I can’t edit functions.php of the parent theme because if it gets updated I’ll lose my changes. What do I have to do to get the theme in another language? Source: https://wordpress.stackexchange.com/feeds

How to return only certain fields using get_posts()

I’m trying to get only the fields that I need using the get_posts() function in WordPress. I currently have the following code: $posts_args = array( ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 5, ‘fields’ => ‘ids’ ); $post_ids_r = get_posts($posts_args); This works fine if I only want to get the id. But if I want to get the permalink or the title of the post along with the ids that’s where I’m not sure what to do. I already tried the following: ‘fields’…

Random Alphanumeric Key URLs

I need random (and unique) alphanumeric permalinks. I’ve looked at several plugins but they all seem to do some form of redirection to a longer URL. That’s not what I want, I want the permalink to be changed. Basically, I’m wanting URLs like bit.ly or 9gag.com. I’ve looked, but came up empty in my searches – does a plugin exist that does this? If not, could someone point me into the right direction as to how I might accomplish it? I’m pretty self sufficient in PHP but I’m not very…

Extending WP_Query — Optimise SQL query

I’m storing posts, a user follows in a custom table that has the columns id, post_id and user_id. To fetch posts that a user follows I have extended the WP_Query as follows: class WP_Query_Posts_User_Follows extends WP_Query { function __construct($args=array()) { if ( !empty($args[‘followed_by’]) ) { $this->followed_by = $args[‘followed_by’]; add_filter(‘posts_where’, array($this, ‘posts_where’)); } parent::query($args); } function posts_where($where) { global $wpdb; $table = $wpdb->prefix . ‘post_followed_by’; $where .= $wpdb->prepare( » AND ID IN (SELECT post_id FROM $table WHERE user_id = %d) », $this->followed_by); return $where; } } If you notice there is sub-query in…

Web Design Weekly #99

Headlines Sneak Peek of Macaw An interesting looking tool preview by the talented Macaw team. The demo video walks through a sample project – from blank canvas to spiffy code. (macaw.co) Bower 1.0.0 released with a new architecture!(github.com) Make it Count (csswizardry.com) Support this newsletter by becoming a member for the price of a coffee → Articles Does Flexbox Have a Performance Problem? A slight murmuring of performance issues relating to Flexbox in a recent Smashing Magazine article triggered Chris Coyier to do what he does best. Dive into the…

Displaying custom-taxonomy-terms sorted by parent/child-hierarchy?

I have a custom post type with a custom taxonomy (to show some « best practice » examples on my website). On the single-post-page (single-bestpractice.php) I wanted to show all the terms (categories) like this: Parent: Child, Child, Child I tried this code: $customPostTaxonomies = get_object_taxonomies(‘bestpractice’); if (count($customPostTaxonomies) > 0) { foreach ($customPostTaxonomies as $tax) { $args = array( ‘orderby’ => ‘name’, ‘show_count’ => 0, ‘pad_counts’ => 0, ‘hierarchical’ => 1, ‘taxonomy’ => $tax, ‘title_li’ =>  » ); wp_list_categories( $args ); } } which outputs: Child, Child, Parent, Child, …so, is there…

Search / Filter posts on Title/Content OR Tags

I need to make a custom query to look for posts (CPT) which match a certain keyword but it have to search posts in both the title, the content AND a custom taxonomy terms. I’ve tried with to queries but I just can’t get it to work and I’ve of cause made sure that there are content in wordpress which match the criteria. For clarification I’ll just explain the use case. I got a CPT called products The CPT has a custom taxonomy called details There are approximately 100 details…

Web Design Weekly #98

Headlines Full Stack Coding in The Chrome Dev Tools! If you use the Chrome Dev Tools then this is a must watch. Over the last couple of years Remy Sharp has shared his workflow. Every screencast he shares always has some great tips, but this one is slightly mind blowing! (remysharp.com) Looking Into the Future of Sass Nathan Weizenbaum and Chris Eppstein are working extreamly hard on version 3.3 of Sass. There is no offical date on when this will drop, but it should be very soon… This post by…

Include a page template along with add_theme_support()

I’m not even sure this is possible but before I start thinking up crazy solutions, I’ll see if there is a WordPress way to do it. Here’s the deal. I have a timeline jQuery plugin all set up on WordPress and I want it to be callable in a child theme through the add_theme_support method: add_theme_support( ‘timeline’ ); Call it an obsession with modular design. I’ve probably read too much Tadlock for any one man’s sanity but it’s working for me. So the first part works just fine. I’ve got…

Web Design Weekly #97

Headlines Writing DRYer vanilla CSS Excellent short tutorial by Harry Roberts on maintainable CSS. It’s a short tip-style post covering how and where you can spot the chance to DRY things out in your regular/‘vanilla’ CSS. (csswizardry.com) Free tutoring For HTML, CSS and JavaScript Jeremy Kahn works at YouTube and is keen to move the web forward. This is his little bit. What an awesome idea. Rock on Jeremy! (jeremyckahn.com) If one hit a week ain’t enough, follow Web Design Weekly on Twitter! Articles CSS sourcemaps and in-browser Sass editing…