• 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

CSS IE Printing A Lot of Blank Pages

August 15, 2012 by Webhead

Problem

One of the smaller pages on a wordpress site I was working on printed about 75 pages in Interent Explorer (73 of which were blank).  Both Firefox and Chrome printed the normal 1-2 pages.  Only the contact us page had this problem.

 

Solution

Luckily only the contact us page had this problem.  It uniquely had a google maps plugin (the Comprehensive Google Map Plugin).  This google map plugin is very useful and handy, but for printing it was causing the problem in IE.  The global-data-placeholder object that this plugin inserted had the top and left css style as “100000px !important”.  It had a height and width of 0 so it normally does not show.  I kind of remember IE having problems with 0 height and 0 width objects though.  Anyway, I simply made a print_styles.css and set that to not display.

#global-data-placeholder { display:none;}

 

source: http://blogs.unbolt.net/index.php/brinley/2011/07/23/ie-8-prints-page-with
keywords: css ie web page print lots of pages

Filed Under: Coding Tagged With: css, IE crap, wordpress

Contact Form 7 Multi-Step Forms

August 8, 2012 by Webhead

UPDATE:  This plugin still works as expected for most people, but if it doesn’t work for you, I have found a great alternative that I personally use for larger projects: Formidable Pro.  Formidable allows multi-page forms, ajax submissions, and more.  It does so much more than Contact Form 7 and Contact Form 7 Multi Step Forms.  There is a free and a paid version.  The paid version is very cheap for what you get.  In my opinion it is much better than the more expensive Gravity Forms.

My first official wordpress plugin is one that modifies the Contact Form 7 plugin.  And yes, you’ll need the Contact Form 7 plugin activated in WordPress.   I needed a contact form that spanned across multiple pages and in the end would send an email with all the info collected.  Here are the steps to use it once it’s installed.

  1.  Create a contact form 7 form as you normally would.
  2.  Add a hidden tag named “step” with the value being the current step dash (“-“) total steps. If you have a 5-step form and you are creating the first step, the hidden field would look like: [hidden step “1-5”]
    the last step, would look like: [hidden step “5-5”]
  3.  In the “Additional Settings” textarea at the bottom of the form editing page, add in the location of the next form.
  4. If the next form is located on My2ndPage on example.com you would add the following to the “Additional Settings” textarea:  on_sent_ok: “location.replace(‘http://example.com/My2ndPage/’);”
  5.  Repeat steps 1 – 3. On the form that will actually send a email, do not do step 3 unless you want the form to redirect the user to another page.

A working sample can be seen at:
http://webheadcoder.com/contact-form-7-multi-step-form/

Get the Contact Form 7 MultiStep Forms in the WordPress Repository.

 

 

Filed Under: Coding Tagged With: php, wordpress

Extending Contact Form 7

August 8, 2012 by Webhead

Contact Form 7 is a wordpress plugin that allows users to easily put forms into wordpress pages.  These forms are very basic, but very extensible.  I recently had a task to change Contact Form 7 to be a 2-step form.  In doing this I found a lot of hooks and help.  In the end created my first official wordpress plugin.

Posts explaining how to send a form to another form:  http://wordpress.org/support/topic/plugin-contact-form-7-use-cf7-with-action-another-wp-page

Guide to customization: http://hecode.com/easy-contact-form-7-guide-and-customization/

Add a hidden field: http://wordpress.org/extend/plugins/contact-form-7-modules/

 

Filed Under: Coding Tagged With: php, wordpress

Get rid of category in wordpress url permalink

July 23, 2012 by Webhead

To get rid of the ‘/category/’ in your wordpress peramlink url, download the following plugin:

 

WP No Category Base

Filed Under: Coding Tagged With: wordpress

Other Languages showing as ??? in WordPress

May 29, 2012 by Webhead

Problem

I copy-pasted some Japanese text into the WordPress editor and it shows as ????.  On another server, pasting the same japanese text shows the japanese text on the page.  No plugins seem to be affecting this.  Something with the server or WordPress configuration must be affecting displaying the foreign characters.

Solution

The problem was caused by using the Fantastico automatic install from the cpanel.  When Fantastico installs wordpress all the fields in the database have a data type of “latin1_swedish_ci”.  Using this data type, characters like Japanese and Chinese are not supported.  You’ll need to change the data type of the fields to “utf8_general_ci”.  I changed post_title, post_content, and post_excerpt fields in wp_posts and it seems to be enough.  It depends how much you will have foreign characters though, you may have to change more fields.  More info can be found in the source below.

 

Source: http://wordpress.org/support/topic/special-characters-converted-to-question-marks-on-save
keywords: wordpress not saving japanese characters

Filed Under: Coding Tagged With: debug, wordpress

WordPress debugging

May 25, 2012 by Webhead

Some useful tips for debugging wordpress will be listed here for future reference.

Display All Hooks

If you need to display all hooks, use the command below.  It is useful when trying to find a hook to alter some part of wordpress.

add_action( 'all', create_function( '', 'var_dump( current_filter() ); ' ) );

Display all for a Specific Hook

use the following code:

global $wp_filter;
print_r($wp_filter[$hook_name]);

Display Queries

To display any queries run by wordpress you can set SAVEQUERIES to be true and then print out the queries.

define( 'SAVEQUERIES', true );

Then place the following right after your query:

var_dump($wpdb->queries);exit;

 

Filed Under: Coding Tagged With: debug, php, wordpress

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 7
  • Go to page 8
  • Go to page 9
  • Go to page 10
  • Go to page 11
  • Go to page 12
  • Go to Next Page »

Primary Sidebar

Topics

apache apple bootstrap buddypress chrome cloudways cms css debug drupal eCommerce firebug firefox git gmail goDaddy google hosting htaccess html html 5 IE crap image iPad iPhone javascript jquery kinsta linux localization mac os x ms sql mysql open source optimize php php 7.2 svg tinymce woocommerce wordpress wpengine xss yii youtube




Categories

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