Web Design Weekly #179

Headlines A Baseline for Front-End [JS] Developers Need to level up and become a well rounded JavaScript developer? Well, hopefully this post by Rebecca Murphey can help. (rmurphey.com) Team Communication Starts with HipChat HipChat combines team chat, video chat & file sharing into one simple application. ​Start chatting, it’s free!​ (hipchat.com) Articles Diving into the Fetch API There’s been a lot of hype and confusion around the new fetch API recently. In this article Jake Archibald gives it a bit more clarity. (jakearchibald.com) Animation Principles for the Web Donovan Hutchinson…

How to get a category in a list item class

I am need to know how would I get the category to be dynamically input in a WP_Query This is the code I am using: <li class= »<?php the_category(‘ ‘)?> »> but the output is breaking. This is all the code <ul id= »portfolio-list »> <?php $args = array( ‘post_type’ => ‘post’, ‘post__and’ => array( 15, 14, 17, 13, 10, 8, 12, 11, 9, 16), ); $the_query = new WP_Query( $args ); ?> <?php if ( $the_query->have_posts() ) :?> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <li class= »<?php the_category(‘ ‘); ?> »> <?php the_post_thumbnail(…

the_permalink on the homepage vs posts for sharing links

Instead of weighing the site down with plugins I’ve hardcoded a couple of sharing links. I’ve used the_permalink to create the links, in the sidebar, which work ok on posts and pages, but on the homepage it shows the link of the last post, not the homepage. The code I’m using is pretty basic: <a href= »http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&amp;t=<?php the_title(); ?> » target= »_blank »>Share this on Facebook</a> How can I get the homepage sharing link to use the homepage url, while also working for the posts and pages? Source: https://wordpress.stackexchange.com/feeds

How to get images only attached from edit post page

I have developed a custom wordpress panel with a custom front-end recently. In single post pages there is a slider. I display the result of get_attached_media( ‘image’ ) function as the images of slider. I told editor that upload only the images you would like to see in slider to post from edit post page, upload other images from the media link on the side menu. The problem is that, if the user uploads an image from media screen, then inserts it to content of the post, the image happens…

wp_nav_menu() doesn’t work

I’m working on a theme with custom menus, currently using WP 4.0.1. I’m registering two menus in functions.php: register_nav_menus( array( ‘primary’ => __( ‘Main Menu’, ‘wsy’ ), ‘secondary’ => __( ‘Secondary Menu’, ‘wsy’ ) ) ); Then, displaying them in my header.php file: <nav role= »navigation »> <?php wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘depth’ => ‘1’ ) ); ?> </nav> The problem is, when I select a specific menu from either the Menus page or the customizer, they stop showing up in my page. It doesn’t matter which menu or which location,…

Use subdomain for certain urls

I have the following rules in my .htaccess file on a WordPress (single installation): # REWRITE FORUMS DOMAIN TO FOLDER RewriteCond %{HTTP_HOST} ^forums.example.com$ RewriteRule !^forums/? forums%{REQUEST_URI} [NC,L] # REWRITE FORUMS FOLDER TO SUBDOMAIN RewriteCond %{THE_REQUEST} s/forums/([^s]*) [NC] RewriteRule ^ http://forums.example.com/%1 [R=301,L] This is so that the forums that exist at http://example.com/forums are accessed at http://forums.example.com/ However the server just blows up with a 500 server error… Any ideas on how to do this? These rules work perfectly when used on non-wordpress sites… The second rewrite rules successfully send /forums to…

Web Design Weekly #178

Headlines Strategies for Staying on Top of Web Performance Web performance is hard. Staying on top of web performance is harder. Thankfully in this post Chris Coyier shares some great knowledge to help ease the pain to make sure our sites stay lean. (css-tricks.com) Species in Pieces Some amazing CSS polygon, design and animation work by Bryan James. Great to see good old CSS being used for this. (species-in-pieces.com) No more noisy neighbours. Quad-Core SSD Dedicated Servers – UK Based Quad-core dedicated server, 128GB SSD, Single 500GB HDD, 4GB RAM,…

Adding Easy Digital Download Cart Quantity to Menu

When using the popular e-commerce plugin Easy Digital Downloads it is very common you will want to add the cart quantity to the menu. There are a few ways to do this but I have found adding it to the wp_nav_menu is great for styling consistency and maintainability. First lets look at how to get the cart quantity. <a href= »<?php echo edd_get_checkout_uri(); ?> »> Cart (<span class= »edd-cart-quantity »><?php echo edd_get_cart_quantity(); ?></span>) </a> The above snippet links to the checkout page. It will also update the quantity via ajax if ajax is enabled…