• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

My Monkey Do

A Log of Coding Solutions

  • Home
  • Web Hosts
  • Tools
  • About

wordpress

Optimize WordPress Plugins: Woocommerce

June 25, 2013 by Webhead

Woocommerce is the best ecommerce solution for wordpress, but it loads a hecka lot of javascript (countries) in each page load.  There is a way to get rid of all these extra styles and scripts and just load it for your store.  Follow the source below.

 

source:  http://gregrickaby.com/remove-woocommerce-styles-and-scripts/

Filed Under: Coding Tagged With: optimize, wordpress

WordPress only displays “error”

June 25, 2013 by Webhead

In trying to copy over a theme and partially start over I ran into an issue where WordPress wouldn’t show anything but one word, error.  Well, that’s helpful.  Searching the wordpress forums I found that the problem is actually a security measure from Better WP Security.  Since my newly copied/created theme had so many missing files (404 errors) it blocked me out.  Deactivating that plugin (programmatically) caused the issue to go away.

Source:  http://wordpress.org/support/topic/getting-one-word-error-when-logging-into-wp-loginphp

Filed Under: Coding Tagged With: debug, wordpress

Theme Localization

June 5, 2013 by Webhead

Wodpress theme localization seemed like an easy task.  And while all the info was there, I ran into several hiccups.

PoEdit

This piece of open source software seems like a great tool for localization until it doesn’t work.  For me, it didn’t read the source files correctly.  If the _ or _e functions were not at the start of a line it did not pick it up.  So my results were always empty until I moved one of the functions to the start of the line.

PoEdit doesn’t allow  you to edit.  Normally this is fine, but not good if the source files aren’t read correctly.

 

iCanLocalize PHP Text Scanner

This tool saved the day for me, but not without problems of it’s own.  The scanner apparently looks for the closing PHP tag “?>”.  In one of my files I had no closing tag so it didn’t work for me.  In another file I had it did have the closing tag, but it wasn’t at the end of the file so not all translations were picked up.

In the end I just edited my PHP file to not have the closing PHP tags or if there were a lot, I just edited the po file manually.  After having that set I opened up PoEdit and created the .mo binary.  What a pain.

 

WordPress documentation

The docs say to use languageCode_CountryCode.mo.  This is not true.  In your theme, just use languageCode.mo.

 

qTranslate

On the up side, after doing a ton of searching for my problems I found out about qTranslate.  It is a great WordPress plugin to make translating your website very easy.  It has a textbox/editor for each language when you are editing your post so you can easily understand what’s going on.  It also provides some decent API to use in your themes.

UPDATE:  qTranslate doesn’t really work “out-of-the-box” when using with WooCommerce.  so instead I used WPML.

WPML

WPML is a bit different from qTranslate.  Instead of translating your content inside each post, you translate it all on one page.   It’s pretty good in that  you can retrieve strings from plugins and themes and add localizations right inside of WordPress.  No need to handle .po files and go through the troubles i did.   WPML lets you translate the attributes of products and all strings throughout the checkout (and everything else).

 

Filed Under: Tools Tagged With: localization, wordpress

HTML 5 Flash Fallback Video Player w/ RTMP

April 24, 2013 by Webhead

There are a ton of video player that use HTML5 with flash fallback.  A few years ago I found one named JW Player.  This was a great player that was fully featured.  Keyword being “was”.  I was developing a website that would be using this player, but for the time being I used the free version of the player because I was hoping for a promo code to show up.  As I was developing the site, the company that owns JW Player upped the price from a simple $79 fee to a yearly $99 fee.  This was a big jump in price and developers complained a whole lot, including myself.  (i got the CEO to respond! woohoo!)  but no changes came of it (as of now anyway).

 

When One Door Closes…

Onto a search for a new javascript player that could do HTML5, Flash fallback, and RTMP streaming when flash is used.  A few players I found were jPlayer, videoJS, MediaElement.js, Flowplayer.  Flowplayer costed about $99(to remove the watermark) plus I wasn’t sure if I needed to purchase the flash player for flash fallback.  Confusion is not good to a potential buyer.  jPlayer was the most popular of the free ones, but I couldn’t get the RTMP to work with my video for some reason.  I got the sample to work, but not mine, weird.  videoJs scared me because I saw a post were the flash fallback used Flowplayer which means I could not use it commercially without purchasing.  Would’ve been a legal disaster if I used it and didn’t pay for it.  MediaElementJs was the only one I had no opinion.  It was actually the least popular of all the open source players.  But then I saw that it would be in WordPress core 3.6!  Case closed.  MediaElement.js would be the replacement.

 

Another one Opens

As it turns out MediaElement does not get Firefox to fallback to flash if I use a mp4 video file.  It simply errors out.  It does however, support the webm format.  The WebM format is sponsored by Google and is supposedly the next industry standard for web videos so it would be a good thing if I converted to it.  I found a free converter called Miro Video Converter to convert my mp4 to webm format.  In the end I have a video player that will be integrated into WordPress, a more standard video format, smaller footprint for HTML5 users (mp4 size: 163mb webm:78mb), and no money spent… but a whole lot of time spent looking for this… oh well, the client wins at least.

 

The Old

JW Player, mp4 format

The New

MediaElementJS (WordPress 3.6), webm format, Miro Video Converter

Filed Under: Off the Shelf Tagged With: firefox, google, html 5, open source, wordpress

WP_Query and posts_per_page

March 21, 2013 by Webhead

Problem

The following code does not seem to limit the posts to 3 posts.  Instead uses the wordpress setting of 10 posts:

// The Query
$the_query = new WP_Query( array(
‘nopaging’ => true,
‘posts_per_page’ => 3,
‘post_type’ => ‘post’
) );

WordPress codex says the posts_per_page will be overridden if it is on a feed.  I am using this on the homepage however.

Solution

I have yet to find out why this doesn’t work.  A WORKAROUND is to add a filter like so:

 

function returnlimit() {
return ‘LIMIT 3’;
}
add_filter(‘post_limits’, ‘returnlimit’);
// The Query
$the_query = new WP_Query( array(
‘nopaging’ => true,
‘posts_per_page’ => 3,
‘post_type’ => ‘post’
) );
remove_filter(‘post_limits’, ‘returnlimit’);

 

source: http://stackoverflow.com/questions/7577213/posts-per-page-not-working-for-new-wp-query

Filed Under: Coding Tagged With: php, wordpress

WordPress Maintenance Page

March 8, 2013 by Webhead

If you’ve updated WordPress, you should have noticed that wordpress goes into “maintenance mode” whenever mass plugins or WordPress itself is updated.  What if you wanted to do some manual upgrading?  Then you can manually put wordpress into maintenance mode.

To put wordpress into maintenance mode, just add a .maintenance file (notice the leading dot) in the same folder that contains wp-settings.php.  Then in the file add this:

<?php $upgrading = time(); ?>

When you’re done with your maintenance simply remove the .maintenance file.

 

source:

http://sivel.net/2009/06/wordpress-maintenance-mode-without-a-plugin/

There’s also a way to update what the maintenance page displays.  The default is a white page with a brief message.

http://xtremelysocial.com/2010/how-to-make-an-awesome-maintenance-mode-screen-for-wordpress/

Filed Under: Coding Tagged With: php, wordpress

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 4
  • Go to page 5
  • Go to page 6
  • Go to page 7
  • Go to page 8
  • Interim pages omitted …
  • Go to page 12
  • Go to Next Page »

Primary Sidebar

Topics

apache apple block editor chrome cms css debug eCommerce embed firebug firefox git gmail goDaddy google hosting htaccess html html 5 IE crap image iPad iPhone javascript jquery linux localization mac os x ms sql mysql open source optimize php php 5.3 responsive rest api seo svg tinymce woocommerce wordpress wpengine xss yii youtube




Categories

  • Coding
  • Off the Shelf
  • Plugins
  • Random Thoughts
  • Server Stuff
  • Tools