Category Archives: Wordpress 3

Hard Code Squelch Tabs

Hard code the Squelch tabs in a template so you can use scripts inside the tabs.

Install Squelch Tabs and Accordians.

Then in template:

 HTML |  copy code |? 
01
<div id="squelch-taas-tab-group-0" class="squelch-taas-tab-group squelch-taas-override" data-title="" data-disabled="false" data-collapsible="false" data-active="0" data-event="click">
02
    <ul>
03
        <li class="squelch-taas-tab"><a href="#squelch-taas-tab-content-0-0">Title 0</a></li>
04
        <li class="squelch-taas-tab"><a href="#squelch-taas-tab-content-0-1">Title 1</a></li>
05
        <li class="squelch-taas-tab"><a href="#squelch-taas-tab-content-0-2">Title 2</a></li>
06
        <li class="squelch-taas-tab"><a href="#squelch-taas-tab-content-0-3">Title 3</a></li>
07
    </ul>
08
    <div id="squelch-taas-tab-content-0-0">
09
        Content 0
10
    </div><!-- tab-content-0-0 -->
11
    <div id="squelch-taas-tab-content-0-1">
12
        Content 1
13
    </div><!-- tab-content-0-1 -->
14
    <div id="squelch-taas-tab-content-0-2">
15
        Content 2
16
    </div><!-- tab-content-0-2 -->
17
    <div id="squelch-taas-tab-content-0-3">
18
        Content 3
19
    </div><!-- tab-content-0-3 -->
20
</div><!-- tab group -->

Posted in Squelch Tabs and Accordians, Theming | Leave a comment

WP Ecommerce Shop Styling Purchase Table in Email Template

Using the WP Ecommerce Shop Styling plugin.

Email template product table is improved by adding the following styling to the email template:

 CSS |  copy code |? 
1
#products-table { width: 100%;}
2
#products-table td {padding:5px;}
3
#products-table th{text-align: left;}

Posted in CSS, WP Ecommerce | Leave a comment

Update Text Using PO Files. Translate Text.

A basic guide to translating wp-e-commerce using poEdit

1. Download and Install poEdit : http://www.poedit.net/download.php
2. Run poEdit and open a translation file (.po) from the `wp-e-commerce/languages` folder
3. Go through the list of words / sentences and add in your translations
4. In poEdit make sure you have the box checked in Preferences>Editor ‘Automatically Save .mo file on save’
5. Save your translation file in the `wp-e-commerce/languages` folder give it a descriptive name ie: wpsc-en_US means english – american, wpsc-fr_FR means french – france (note: your filename must have ‘wpsc-’ at the start to work)
6. In your wordpress wp-config.php file edit the line that looks like this:
`define (‘WPLANG’, ”);`
with the file name (without extension) inside the second set of quotation marks.
i.e If I saved my mo file as `wpsc-en_BG.mo` then I would change the WPLANG line to:
`define (‘WPLANG’, ‘en_BG’);`
7. Save your wp-config.php
8. Refresh your website in a web browser, your new translations should now be viewable on your site.

References
http://codex.wordpress.org/WordPress_in_Your_Language
http://codex.wordpress.org/I18n_for_WordPress_Developers
http://www.forumone.com/blogs/post/translating-your-wordpress-site-using-pot-file

Posted in Tips and Tricks, Wordpress 3, WP Ecommerce | Leave a comment

Disable Chrome Minimum Font Size

Using CSS:

 CSS |  copy code |? 
1
2
/*styles for Chrome */
3
@media screen and (-webkit-min-device-pixel-ratio:0) {
4
  Body {
5
   -webkit-text-size-adjust:none;
6
    }
7
 }

This can cause issues in that it disables zoom for font size but it does remove the issue of Chrome wrecking layouts by increasing font sizes etc

Posted in Browsers, CSS, General CSS, Tips and Tricks | Leave a comment

Change Ticket Table Headings on Event Page

To customize the headings on the ticket list on the single events page use this in your theme functions file:

 PHP |  copy code |? 
1
function my_custom_ticket_header($columns){
2
 $columns = array( 'type' => __('Ticket','dbem'), 'price' => __('Price ex.GST','dbem'), 'spaces' => __('Places','dbem'));
3
 return $columns;
4
}
5
add_filter('em_booking_form_tickets_cols','my_custom_ticket_header',1,1);

Posted in Events Manager, Plugins, Wordpress 3 | Leave a comment

Override ie.css in TwentyTwelve for Child Theme

TwentyTwelve loads ie.css from functions.php so to override it in your child theme use the following in your themes functions.php

 PHP |  copy code |? 
1
// remove ie css from twentytwelve theme
2
function mytheme_dequeue_styles() {
3
   wp_dequeue_style( 'twentytwelve-ie' );
4
 }
5
 add_action( 'wp_enqueue_scripts', 'mytheme_dequeue_styles', 11 );
6
//add new from child theme
7
wp_enqueue_style( 'mytheme-ie', get_stylesheet_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '1.0' );
8
$wp_styles->add_data( 'mytheme-ie', 'conditional', 'lt IE 9' );

Place ie.css in your themes css directory.

Original post here

Posted in 2012 Theme, CSS, Wordpress 3 | Leave a comment

Show Recent Posts in Template

In template:

 PHP |  copy code |? 
1
 <?php wp_get_recent_posts( $args ) ?> 

Default $args

 PHP |  copy code |? 
01
 <?php $args = array(
02
    'numberposts' => 10,
03
    'offset' => 0,
04
    'category' => 0,
05
    'orderby' => 'post_date',
06
    'order' => 'DESC',
07
    'include' => ,
08
    'exclude' => ,
09
    'meta_key' => ,
10
    'meta_value' =>,
11
    'post_type' => 'post',
12
    'post_status' => 'draft, publish, future, pending, private',
13
    'suppress_filters' => true ); ?> 

Usage:

 PHP |  copy code |? 
01
<h2>Recent Posts</h2>
02
<ul>
03
<?php
04
 $args = array( 'numberposts' => '5' );
05
 $recent_posts = wp_get_recent_posts( $args );
06
 foreach( $recent_posts as $recent ){
07
 echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
08
 }
09
?>
10
</ul>

Posted in Code, Wordpress 3 | Leave a comment

NextGen Gallery Image Object

The following is a print out of the $image object used in galleries:

Note: [*caption] * added because ‘caption’ seems to be a reserved word

 HTML |  copy code |? 
01
nggImage Object ( 
02
[errmsg] => 
03
[error] => 
04
[imageURL] => http://yoursite.com/wp-content/gallery/logos/wd-logo.jpg 
05
[thumbURL] => http://yoursite.com/wp-content/gallery/logos/thumbs/thumbs_wd-logo.jpg 
06
[imagePath] => /home/username/public_html/wp-content/gallery/logos/wd-logo.jpg 
07
[thumbPath] => /home/username/public_html/wp-content/gallery/logos/thumbs/thumbs_wd-logo.jpg 
08
[href] => 
09
[thumbPrefix] => thumbs_ 
10
[thumbFolder] => /thumbs/ 
11
[galleryid] => 7 
12
[pid] => 101 
13
[filename] => wd-logo.jpg 
14
[description] => 
15
[alttext] => letter head 1 
16
[imagedate] => 2013-02-13 01:09:14 
17
[exclude] => 0 
18
[thumbcode] => 
19
[name] => logos 
20
[path] => wp-content/gallery/logos
21
[title] =>Logos
22
[pageid] => 0 
23
[previewpic] => 101 
24
[permalink] => 
25
[image_slug] => wd-logo 
26
[post_id] => 0 
27
[sortorder] => 0 
28
[meta_data] =>  Array ( 
29
    [0] => 
30
    [aperture] => 
31
    [credit] => 
32
    [camera] => 
33
    [*caption] => 
34
    [created_timestamp] =>  
35
    [copyright] => 
36
    [focal_length] => 
37
    [iso] => 
38
    [shutter_speed] => 
39
    [flash] => 
40
    [title] => letter head 1 
41
    [keywords] => 
42
    [width] => 800 
43
    [height] => 244 
44
    [saved] => 1 
45
    [thumbnail] => Array( 
46
        [width] => 150 
47
        [height] => 150 
48
    ) 
49
) 
50
[gid] => 7 
51
[slug] => logos 
52
[galdesc] => 
53
[author] => 1 
54
[imageHTML] =>
55
[hidden] => 
56
[style] => 
57
[pidlink] => /directory/?pid=101 
58
[url] => http://yoursite.com/wp-content/gallery/logos/wd-logo.jpg 
59
[thumbnailURL] => http://yoursite.com/wp-content/gallery/logos/thumbs/thumbs_wd-logo.jpg 
60
[size] => width="150" height="150" 
61
 =>   
62
[ngg_custom_fields] => Array ( ) ) 
63

Posted in NextGen Gallery, Plugins, Wordpress 3 | 1 Comment

Contact Form 7 Stop Email Being Sent

To prevent the form sending its email use this in themes functions.php within a function: (might no longer work with WP3.5)

 PHP |  copy code |? 
1
// stop email being sent
2
 $wpcf7->skip_mail = 1;

or put this in the additional settings field of the form

 PHP |  copy code |? 
1
demo_mode: on

Posted in Contact Form 7, Plugins, Wordpress 3 | Leave a comment

Contact Form 7 Change Action URL

To send form output to a different file put this in themes functions.php.

This code also limits this change to page 434 and adds the $wpcf7->skip_mail function to stop the form sending an email.

 PHP |  copy code |? 
01
//change action url of paystation form
02
add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
03
function wpcf7_custom_form_action_url($url)
04
{
05
    global $post, $wpcf7;
06
     if ($post->ID === 434) {
07
         //its the payments page
08
// stop email being sent
09
       $wpcf7->skip_mail = 1;
10
        return '/wp-content/themes/mytheme/refresh.php';
11
 
12
    } else {
13
        return $url;
14
    }
15
 }

Form data is POSTed to refresh.php but the form ajax will keep the initial page loaded.

To redirect to the second file you can disable the Contact Form 7 scripts as described here

This removes validation but this can be added using a custom script as described here

Posted in Contact Form 7, Wordpress 3 | 3 Comments