Plugins

Enable or Disable Automatic Updates of WordPress Core, Themes and Updates using Functions.php

Placing this in functions.php will enable automatic updates of the WordPress core, plugins and themes. /* configure automatic updates */ add_filter( ‘auto_update_core’, ‘__return_true’ ); add_filter( ‘auto_update_plugin’, ‘__return_true’ ); add_filter( ‘auto_update_theme’, ‘__return_true’ ); Changing __return_true to __return_false disables said updates. These can be further refined to limit the level of updates and include only certain plugins.…

Read More

Display Posts Shortcode – Change Date Format

Default date format in the Display Posts Shortcode plugin is hard coded in the plugin but it can be changed using a filter. By default the date format is (8/29/15) which is useless for countries other than the USA. The following function can be placed in the THEME/functions.php file to change the format so that…

Read More

Email Address Encoder – Till

Plugin encodes email addresses in content. Can be used to encode email addresses in templates as follows: If the content is a PHP string, run it through the eae_encode_emails() function: $text = eae_encode_emails($text); To encode a single email address, use the eae_encode_str() function: echo eae_encode_str(‘name@domain.com’); More info: http://wordpress.org/plugins/email-address-encoder/faq/

Read More

WP Snippets

Add text snippet as a custom post then access it via a shortcode: [snippet slug=”my-cool-snippet” /] or in template echo do_shortcode(‘[snippet slug=”my-cool-snippet” /]’); More information from the plugins site: http://www.websharks-inc.com/product/wp-snippets/

Read More

Track Contact Form 7 Submissions using Google Analytics

In additional settings field of Contact From 7 admin: on_sent_ok: “_gaq.push([‘_trackEvent’, ‘Contact Form’, ‘Submit’]);” Google Analytics will track it as an event with Contact Form as the Category, and Submit as the Action. In Google Analytics go to Content > Events > Overview

Read More

Get Category Slug on Single Product Page

In wpsc_single-product.php: //get cat of product $query_data = Array(); $pr_post_id = wpsc_the_product_id(); $categories = wp_get_object_terms($pr_post_id , ‘wpsc_product_category’ ); //if product is associated with more than one category if(count($categories) > 1 && isset($wpsc_query->query_vars[‘wpsc_product_category’])) $query_data[‘category’] = $wpsc_query->query_vars[‘wpsc_product_category’]; elseif(count($categories) > 0) $query_data[‘category’] = $categories[0]->slug; Then you can use the category slug as follows for example: if($query_data[‘category’] == “t-shirts”){…

Read More

Get Link to Featured Image for use in View

In functions.php create function and shortcode /** *************************************************** * get image src for featured image of post (large version) */ /* Register our short code at the appropriate time during the WordPress Boot process. */ add_action( ‘init’, ‘wpk_register_shortcodes’); function wpk_register_shortcodes(){ add_shortcode(‘my_get_thumbsrc’, ‘my_get_thumbsrc’); } /* Function to return the source url for the featured image of…

Read More

WP Ecommerce variation out of stock message

When a variation is out of stock WP Ecommerce defaults to saying that the product is out of stock rather than just the variation. There is fork on Git hub covering this at: https://github.com/wp-e-commerce/WP-e-Commerce/pull/495 The fix is as follows: wp-content/plugins/wp-e-commerce/wpsc-includes/ajax.functions.php Around line 100 change as follows: – $cart_messages[] = sprintf( __( ‘Sorry, but the item…

Read More

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: function my_custom_ticket_header($columns){ $columns = array( ‘type’ => __(‘Ticket’,’dbem’), ‘price’ => __(‘Price ex.GST’,’dbem’), ‘spaces’ => __(‘Places’,’dbem’)); return $columns; } add_filter(’em_booking_form_tickets_cols’,’my_custom_ticket_header’,1,1);

Read More

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 nggImage Object ( [errmsg] => [error] => [imageURL] => http://yoursite.com/wp-content/gallery/logos/wd-logo.jpg [thumbURL] => http://yoursite.com/wp-content/gallery/logos/thumbs/thumbs_wd-logo.jpg [imagePath] => /home/username/public_html/wp-content/gallery/logos/wd-logo.jpg [thumbPath] => /home/username/public_html/wp-content/gallery/logos/thumbs/thumbs_wd-logo.jpg [href] => [thumbPrefix] => thumbs_ [thumbFolder] => /thumbs/ [galleryid] => 7…

Read More