THE PENDING DRAFT

Show “Read More” Link only when there is more content

January 4, 2015

Normally when you post something to your blog, it shows an excerpt on the homepage together with a “Read More” Link in some form which links to the actual content.

But what if your excerpt already is the whole content you want to display and there is no more content to read. Of course you could use the_content inside your loop. That works in most situations, but in some situations you actually wan’t to check whether there is more inside the post than what you already got with your excerpt.

After a bit of fiddling around with different snippets, i came up with this solution, which still has some flaws, but works for what i used it now.

<?php if ( strlen(get_the_content()) > strlen(get_the_excerpt()) ) : ?>
  <p><a href="<?php the_permalink(); ?>" class="more-link">More</a></p>
<?php endif ?>

What it does is comparing the length of the strings of get_the_content() and get_the_excerpt() and only output our custom more link, if the content is longer.

I’m not 100% sure if this is the proper way of doing this, but it worked for me. If you know any other ways of achieving the same result, go ahead and add it in the comments.

WordPress.org Support Thread 

An Introduction to Backbone.js

January 2, 2015

After several not so successful attempts to understand Backbone.js by just staring at the code in WordPress Core that makes up the Media Uploader, i decided it is time to jump in and learn some more about it from scratch. It’s pretty overwhelming at first, especially if your JavaScript knowledge is only basic, which is one thing i’d like to change this year.

I might share some of the best tutorials and introductions i found useful along my way in a later post, but for now here’s a good short video introduction to the basics of Backbone.js by Sidney Maestre that i just found:

Chris Lema on the art of giving estimates

June 24, 2014

Chris Lema with some practical tips and his personal way of giving project estimates. Best article i read on the subject in a long time.

“I know you may think that if you give me a budget I’m going to make the project use up all that budget, even if it’s smaller. Let me assure you of one thing – and this isn’t personal and it’s not you. Most people’s budget is 2-3 times smaller than their desires or expectations.”

Chris Lema – The art of giving an estimate (that’s helpful)

webdesignrepo

April 1, 2014

webdesignrepo is a curated collection of helpful links from around the web. Primarily the repo is for webdesign links, but there is a large overlap with web development and graphic design.

Huge collection of all kinds of links related to webdesign, sorted in “Daily Visits, Blogs/News, Inspiration, Learning, Tutorials, Snippets, Plugins, Architecture, Tools, Resources and Community”. Definitely something to bookmark!

WordPress Development and the Twelve-Factor App

November 18, 2013

The Twelve-Factor App is a set of principles to build Web-Apps which can be applied to apps written in any language. Inspired by an article about taking Twelve-Factor to Drupal, Scott Walkinshaw translated those principles to WordPress development. This is what he has to say about Version Control Systems:

Using version control is the single best thing you can implement for any software project. It will make things easier and eventually save your ass. It’s also the difference between professional and amateur developers. You shouldn’t be charging people if you aren’t using it.

Even if there’s a lot i didn’t completely understood, i still really enjoyed reading this short series of posts.

Turning a WordPress site into a Twelve-Factor App

Simulate slower Network Connections with the Network Link Conditioner

September 9, 2013

Network Link Conditioner

 

As more and more people will access your final work on Tablets, Phones and even Laptops with less-than-optimal speed, it is important to test your pages performance on slower network connections. There’s a very handy little tool in Apple’s Developer Tools, which let you set the Connection Speed of your Mac to simulate the average 3G or Edge Network.

To install this preference pane you need to open Xcode, go to the Xcode Menu and choose “Open Developer Tool” and then “More Developer Tools…”, this will take you to the Apple Developer site. Login and then download the “Hardware IO Tools for Xcode” which will download a dmg which contains the Network Link Conditioner, amongst other tools.

Add a custom WordPress Dashboard Widget

August 26, 2013

Sometimes you want to show a custom widget in the WordPress Dashboard. I use this function a lot, for example on client sites to provide some direct access to contact information for support or to show some custom messages to guide your clients with your theme, plugin or service. This little snippet will create a new widget and show it in the Admin Dashboard. Nothing more.

// Create the function for the content of our custom widget
function pdr_dashboard_widget_function() {
    echo "Display whatever it is you want to display inside your custom dashboard widget";
}

// Add our custom dashboard widget
function pdr_add_dashboard_widgets() {
    wp_add_dashboard_widget('pdr_dashboard_widget', 'Custom Dashboard Widget', 'pdr_dashboard_widget_function');
}

// Hook everything into the 'wp_dashboard_setup' action to register our functions
add_action('wp_dashboard_setup', 'pdr_add_dashboard_widgets' );

 

Put that code inside your functions.php, or inside a custom plugin and you will have a basic widget right in your WP Dashboard.

Remote Debugging for iOS Devices with Safari

August 25, 2013

I was pretty impressed when i first saw how Ghostlab enables us to remotely debug a design on a mobile device. While Ghostlab can do many other things, remote debugging on an iOS device is also possible directly from within Safari. I’m honestly not sure if this is a new feature or not, but it’s very cool and pretty easy to use.

1. Connect your device via USB
2. On your iPhone, go to Settings / Safari / Advanced and activate “Web Information”
3. On OS X, open Safari and activate the dev tools
4. Open any website on your iOS Device
5. Now you should see your device(s) in the Menu “Developer” in Safari form where you can access the Web Inspector for any open site on your iOS device.

As far as i found out, this is only possible with iOS 6 and up and Safari on a Mac. There’s a similar function in Chrome to remotely debug on Android devices, which i haven’t tried yet, but looks exactly the same.

Apply Filters – A WordPress Development Podcast

August 23, 2013

applyfilters

Brad Touesnard and Pippin Williamson launched a new Podcast about WordPress Development. It is focused solely on Developing and Coding for WordPress, so they don’t have to “worry about annoying the non-developer listeners in the audience”, in their own words.

Here’s what they have to say about Apply Filters in the description:

Our discussions will include everything from development in WordPress core, plugins, and themes. We will be sharing much of our own experiences as developers that work fulltime in WordPress development, as well as bringing on guest developers to share their stories.

But don’t be afraid of that, i would consider myself more of a designer than a coder and still really enjoyed the first episode and looking forward to the next one.

Brad Touesnard is the founder of Delicious Brains, the company behind such great plugins as WP Migrate DB Pro, a plugin to easily migrate your WordPress databases.

Pippin Williamson is the head of Pippins Plugins and creator of many popular plugins such as Easy Digital Downloads or Restrict Content Pro. He also reviews plugins for the official WordPress.org plugin repository and contributes to WordPress core and bbPress.

I even learned something new right in the first episode when they talked about a new function get_attached_media(), which was introduced in WP 3.6. As the name suggests, it loads all media attached to a particular post, which always was a bit hacky to do in the past and it’s good to know there’s a better way by now.

If you’re into WordPress Development, whether as a Theme Designer or a Plugin Developer and want to learn a new trick or two, go check them out.

Apply Filters – WordPress Development Podcast