Stuff in the ‘WordPress’ Category

Realto Theme Plus dsIDXpress Plugin Results in Double Thumbnails

Friday, October 16th, 2015

We were recently approached by a client who was having a problem with a site they were building. They are using the Realto theme, plus the dsIDXpress plugin.

The site was experiencing double / duplicate thumbnails for the home slideshow, which is clearly a problem, especially since it caused the thumbs to not correspond to the correct slide.

Through some troubleshooting, we discovered that both the plugin and the theme are loading the jquery files for the Cycle2 slideshow. With two scripts running on the same slideshow, it caused this duplicate behavior. The solution was clear: remove one of the two scripts from being loaded.

Possible solutions included:
1. Removing / Commenting out the code that loads the script in the IDX plugin. (Bad plan, because the next time the plugin is updated, the code will re-appear, and the problem will happen again).
2. Removing/ Commenting out the code that loads the script in the Realto theme. (Also a bad plan, but less so than #1, since themes usually get updated less frequently than plugins).
3. Write a plugin to de-enqueue the script. This is viable and clean, but not ideal (more work, plus another plugin in the system).
4. Fortunately, the client was using a Child Theme, so we were able to use this clean / viable solution, without adding more plugins: de-enqueue the script in the Child Theme’s function file. (This would not have been possible if the client was not using a child theme).

For reference, here’s the code that we simply added to the child theme’s functions.php file:

add_action('wp_print_scripts', 'realto_cleanup_scripts');

function realto_cleanup_scripts() {
	 wp_dequeue_script( 'nt-jquery.cycle2.min' );
}

If you needed to make this a plugin, it would actually be a simple matter. Create a new file (no need to put it in a folder), title the file something like “realto-dequeue-script.php”, and add the below code to the file. Drop it into the wp-content/plugins folder, activate the plugin, and voila!

/*
Plugin Name: Realto Remove Cycle2 
Plugin URI: http://www.alphachannelgroup.com/
Description: This plugin de-enqueues the Cycle 2 slideshow script.
Author: Alpha Channel Group
Author URI: http://www.alphachannelgroup.com/
Version: 1.0
*/

add_action('wp_print_scripts', 'realto_cleanup_scripts');

function realto_cleanup_scripts() {
	 wp_dequeue_script( 'nt-jquery.cycle2.min' );
}

Migrating a Single Site from One WordPress MultiSite to Another

Tuesday, October 28th, 2014

For Developers or Power Users

Warning: This article is designed for developers, or the technically experienced.  You should be comfortable working in databases, and utilizing FTP.

Overview:

We need to move a single site from within a WordPress MultiSite to another WordPress MultiSite.  The site is completely set up, including plugins, widgets, theme options, and other settings.

We want to preserve as much of the data as possible, without hosing the complete installation.

Note: for convenience sake, we used the following terms:

Source Install – the original site, that we are moving somewhere else

Target Install – the new site location, where the source site will be moved.

Steps:

None of the import / export that we have found tools cover this scenario, so we have developed a process:

  1. Set up the new site in your Target MU Install.  Take note of the site ID (prefixed in all of the database tables).  This will be referred to as the Target Site ID.
  2. In your existing Source Install, take note of the site ID.  This will be referred to as the Source Site ID.
  3. By accessing the database (for example, using phpMyAdmin), export the tables in your Source Install.  Only export those that pertain to the single site.  They should contain the site ID, for example “wp_3_options”.
  4. Make a comprehensive list of all relevant plugins being used in your Source Install – remember, there’s “network activated” plugins as well as “site-specific” plugins.
    1. FTP the plugins from the Source Install.
    2. FTP the theme from the Source Install.
    3. IMPORTANT: Prior to uploading the database, or trying to visit the site, it’s imperative that all of the plugin / theme files exist on the Target Install.
    4. FTP the plugins and theme to the Target Install.
  5. Open the SQL export file created from step 3 above in your favorite text editor.  Update all table names to reflect the Target Site ID.  Also change them to reflect the table prefix of the Target Install.
    1. Example: if the  Source Site ID is 3, and the Target Site ID is 5, and they both use the same table prefix of “wp_”, then you would find all table names and change them according to the following model:
      1. “wp_3_options” would be updated to “wp_5_options”.
    2. If the table prefix in the Source Install is “wp_'”, and the table prefix in the Target Install is “38921_”, then the example would look like:
      1. “wp_3_options” changes to “38291_5_options”.
    3. We are only using the options table as an example.  Currently there are 9 tables in a WP MU “site”, plus there may be additional tables depending on plugins or your theme.
    4. IMPORTANT: If you aren’t familiar with table prefixes, or any of this seems off, then we recommend you consult with someone familiar with WordPress, particularly Multi Site installations.
  6. In your Source Install, run the following query on your posts table to get a listing of all media / attachments that will need to be manually moved using FTP:
    1. “SELECT * FROM `wp_3_posts` WHERE `post_type` = ‘attachment’
    2. This will list all of your attachments.  This will help you ensure that you know all of the attachments that need to get moved.
    3. Check the source wp-content/uploads folder for a “sites” sub-folder. There should be a sub-folder that is named the same as your site ID, such as wp-content/uploads/site/3.   This would be the media for your specific site.
    4. Using FTP or rsync, move the contents of the uploads folder (wp-content/uploads/sites/3) to your target install (wp-content/uploads/sites/5).
  7. Import the SQL file that you have altered into the Target Install database.

If the site domain is changing, then the following steps may be required.

  1. Run the searchreplacedb tool on the Target Install database to update the site.  Be sure to only select the tables in your migrated site – not the entire database!
  2. After running searchreplacedb tool (available here), you may need to run it again to clean up certain paths.  These may be true for image folders, particularly if the new domain has a path in it, such as :www.mydomain.com/subfolder
  3. If the site domain is changing and you are getting 404 errors when you view the site, you may need to flush the rewrite rules. In a non-MU install, this is done by going in the dashboard to the “Permalinks” page and simply clicking “Save”.  In an MU installation, the only way we are aware of is to deactivate and reactivate the theme.

Test and Tweak

As with anything, some good testing is likely in order.  We have found that the most likely place for mistakes to happen is when running the searchreplacedb tool – be sure the new urls are correct.

 

Notes for future updates:

 

Import External Images plugin

Copy / FTP files from uploads/sites/[Site_id]

run SRDB2 to update images loading from proper site ID.

Pixuru

Friday, April 19th, 2013

pixuru-screenshot
We just wrapped up the e-commerce site for Pixuru (if you visit, be sure to look for a few Easter eggs we built in for them!) Their site allows you to order a canvas via a very cool interface. Upload your image, then you can crop it, zoom it, and even select the frame color all in an easy to use interface that shows you what your canvas will look like. Place your order, and before you know it you’ll receive a high quality canvas print of your image. Super cool! Developed in OpenCart, with a sister WordPress site for the content management, it looks great and works beautifully.

Free Stuff for Our Clients

Saturday, July 9th, 2011

My core business is web development, but there’s a lot of accessories that seem to go along with owning a website. So, I’ve invested in some tools and services that I offer my clients, at no extra charge: Read More →

WordPress More Tag Not Working on Custom Blog Template

Tuesday, June 21st, 2011

Many of the themes I create have a custom structure – I set up a template for the blog page, which allows separate sidebars, as well as a variety of other features to be available in the themes. Read More →

Beware of WordPress Plugin Bloat

Thursday, May 26th, 2011

I Love WordPress

WordPress is amazing, there’s no two ways about it. I’m a huge fan, and I’ve therefore found myself doing lots of WordPress development and programming for my clients. Read More →

Taming Media Upload in Your Theme or Plugin

Friday, April 8th, 2011

And changing that pesky “Insert Into Post” button

For all you WordPress developers out there, here’s some good news:

You CAN use the built-in WordPress Media Upload functionality in your plugin or theme.  I can’t take credit for figuring THAT out – that goes to Matt with Read More →