Tag Archives: wordpress

Gravity Forms – Disable and Remove the “Map It” Link

In the Gravity Forms generated emails, if your form has a “address” field the email notification generated by using something like {all_fields} will have a “Map It” link associated with the address, which will open Google Maps. Add this code to your theme’s functions.php file to disable / remove the “Map It” link from the email notification. // code courtesy of https://techblog.willshouse.com/?p=5249 add_filter(“gform_pre_send_email”, array($this,’gform_pre_send_email’)); function gform_pre_send_email($email) { // attempt to match the link using a regular expression $test = preg_replace(“#\<a [^>]+?\>Map It[^>]+\>#i”, ”, $email[“message”]); // if the result is not empty / blank, use it to replace the original html if(trim($test)) { $email[“message”] = $test; } return $email; } If you want to hide the “map it” link from the HTML that is displayed on a webpage ( if you confirmation has the {all_fields} merge replacement in it ) then you can add some CSS like this: <style> a.map-it-link { display: none; } </style></a>

Posted in Tech Tips, Web Development | Tagged , | 2 Comments

WordPress SEO Variables

A simple list of all the WordPress SEO replacement variables for creating dynamic titles / tags – updated as of Joost / Yoast’s SEO plugin version 1.4.23: %%sep%% %%sitename%% %%sitedesc%% %%currenttime%% %%currentdate%% %%currentday%% %%currentmonth%% %%currentyear%% %%date%% %%searchphrase%% %%page%% %%pagetotal%% %%pagenumber%% %%term404%% %%caption%% %%category%% %%excerpt%% %%excerpt_only%% %%focuskw%% %%id%% %%modified%% %%name%% %%tag%% %%title%% %%userid%% %%category_description%% %%tag_description%% %%term_description%% %%term_title%% %%pt_single%% %%pt_plural%% %%category%% %%tag%%

Posted in Tech Tips | Tagged | Leave a comment

WordPress 3.8 Released

WordPress 3.8 is here (ok, almost!) but you can get it now to see some of the cool stuff. After upgrading you’ll get: Welcome to WordPress 3.8 – Thank you for updating to WordPress 3.8, the most beautiful WordPress yet. Features include: Introducing a modern new design Modern aesthetic – The new WordPress dashboard has a fresh, uncluttered design that embraces clarity and simplicity. Clean typography – The Open Sans typeface provides simple, friendly text that is optimized for both desktop and mobile viewing. It’s even open source, just like WordPress. Refined contrast – We think beautiful design should never sacrifice legibility. With superior contrast and large, comfortable type, the new design is easy to read and a pleasure to navigate. WordPress on every device – We all access the internet in different ways. Smartphone, tablet, notebook, desktop — no matter what you use, WordPress will adapt and you’ll feel right at home. High definition at high speed – WordPress is sharper than ever with new vector-based icons that scale to your screen. By ditching pixels, pages load significantly faster, too. Refined theme management The new themes screen lets you survey your themes at a glance. Or want more information? Click to discover more. Then sit back and use your keyboard’s navigation arrows to flip through every theme you’ve got. Smoother widget experience Drag-drag-drag. Scroll-scroll-scroll. Widget management can be complicated. With the new design, we’ve worked to streamline the widgets screen. Have a large monitor? Multiple widget areas stack side-by-side to … Continue reading

Posted in Design, Software | Tagged | Leave a comment

Gravity Forms: Prevent Scrolling on Next / Previous Ajax Submits

Step 1: Identify your Form ID Figure out what your form ID is – look in the address bar as you edit your form: Step 2: Add a Filter Edit something like your theme’s functions.php file and add a filter for the form number: add_filter(‘gform_confirmation_anchor_5′,’theme_gform_confirmation_anchor_5′); function theme_gform_confirmation_anchor_5($enabled) { return false; } Step 3: Done Now the code in the gravity forms plugin won’t fire that causes the form to scroll on ajax submits of multi-paged forms. (no need to change this, code for reference only): if($use_anchor !== false) { $scroll_position[‘default’] = is_numeric($use_anchor) ? “jQuery(document).scrollTop(” . intval($use_anchor) . “);” : “jQuery(document).scrollTop(jQuery(‘#gform_wrapper_{$form_id}’).offset().top);”; $scroll_position[‘confirmation’] = is_numeric($use_anchor) ? “jQuery(document).scrollTop(” . intval($use_anchor) . “);” : “jQuery(document).scrollTop(jQuery(‘#gforms_confirmation_message’).offset().top);”; } Step 4: Replace scrolling behavior with something like jQuery Smooth Scroll Use code similar to this to scroll to a certain element after one of the submit buttons has been clicked: <script src=”//cdnjs.cloudflare.com/ajax/libs/jquery-smooth-scroll/1.4.12/jquery.smooth-scroll.min.js”></script> <script> jQuery(document).on(‘click’,’.gform_page_footer input’, function() { jQuery.smoothScroll({ scrollTarget: ‘.gform_wrapper’, offset: -20 }); }); </script>

Posted in Tech Tips | Tagged , | 1 Comment

How to Suppress WordPress Update E-mails

Did you recently get an email that said something like: Howdy! Your site at http://example.com has been updated automatically to WordPress 3.7.1. The file that is responsible is: wp-admin/includes/class-wp-upgrader.php And the function is send_email which is part of the class WP_Automatic_Updater To disable the email messages you can add this code: add_filter( ‘auto_core_update_send_email’, ‘__return_false’ ); For a lot of great options related to managing automatic updates in WordPress 3.7+ see this question.

Posted in Tech Tips | Tagged | Leave a comment

wordpress get posts by id

Simple solution for the wordpress get_posts function to get a list of posts by post id / an array of post ids: $args = array( ‘post__in’ => array(34,36) ); $posts = get_posts($args); It’s always really hard for me to remember that crazy post__in with a double underscore between post and in.

Posted in Tech Tips | Tagged | Leave a comment

Failed to import Media – Solved

If you’re running WordPress and trying to export and import posts with the WordPress Importer you may be getting an error saying Failed to import Media Fortunately this plugin allows error debugging – you just have to turn it on. You can figure out what is causing the error by turning debugging on. There are two methods for this. First, you can edit the plugin file: /wp-content/plugins/wordpress-importer/wordpress-importer.php Change line 17: define( ‘IMPORT_DEBUG’, false ); to instead be true: define( ‘IMPORT_DEBUG’, true ); You can also edit your wp-config.php file and add this line: define( ‘IMPORT_DEBUG’, true ); That should hopefully help you stop this error: However since the plugin will attempt to redefine a constant that is already defined it may add errors to your log files, which means you should probably use the first method, or just remove line 17 from the plugin file.

Posted in Web Development | Tagged , | Leave a comment

WordPress: Enable Link Manager

Here is how to turn on and re-enable the link manager in WordPress. As of Version 3.5, the Links Manager and blogroll are hidden for new installs and any existing WordPress installs that do not have any links. You might think you need to do something like this: add_theme_support(‘link_manager’); But actually the plugin that re-enables the link manager is but a single line of PHP code: add_filter( ‘pre_option_link_manager_enabled’, ‘__return_true’ ); Which brings back the familiar link manager ( /wp-admin/link-manager.php ):

Posted in Tech Tips, Web Development | Tagged | Leave a comment

WordPress Introduces Twenty Thirteen

The new default theme puts focus on your content with a colorful, single-column design made for media-rich blogging. Inspired by modern art, Twenty Thirteen features quirky details, beautiful typography, and bold, high-contrast colors — all with a flexible layout that looks great on any device, big or small.

Posted in Design, Tech Opinion | Tagged | Leave a comment

GravityForms: tw-sack.min – Uncaught SyntaxError: Unexpected identifier tw-sack.min.js:1

Here is what the error looks like in the Chrome Debugger Console: Uncaught SyntaxError: Unexpected identifier tw-sack.min.js:1 If you’r getting a problem with editing forms in GravityForms, or perhaps trying to add fields, you can take a look at the source code and you’ll see what happens – an AJAX request is made, but twsack does not like the response which looks something like: EndAddField({“id”: 1, “label”: “Hidden Field”, “adminLabel”: “”, “type”: “hidden “, “isRequired”: false, “size”: “medium”, “errorMessage”: “”, “inputs”: null}, ” <li id=’field_1′ class=’selectable gfield gform_hidden’ ><div class=’gfield_ admin_icons’><div class=’gfield_admin_header_title’>Hidden : Field ID 1</div><a class=’field_delete_icon’ id=’gfield_delete_1′ title=’click to delete this field ‘ rel=’nofollow’ href=’#’ onclick=’StartDeleteField(this); return false;’>Delete</a><a class=’f ield_duplicate_icon’ id=’gfield_duplicate_1′ title=’click to duplicate this fiel d’ rel=’nofollow’ href=’#’ onclick=’StartDuplicateField(this); return false;’>Duplicate</a><a c lass=’field_edit_icon edit_icon_collapsed’ title=’click to edit this field’>Edit </a></div><label class=’gfield_label’ for=’input_1′>Hidden Field</label><input p laceholder=”Hidden Field” name=’input_1′ id=’input_1′ type=’text’ value=” dis abled=’disabled’/></li>”);m So the problem is actually that the response comes back with a Content-type of json, javascript, or html when it should be returned as text/plain – something like: Content-Type: text/html; charset=UTF-8 To test, I edited the file form_detail.php and changed line 2178 (or rather inserted this line) – for gravity forms 1.7.5 (omit the line numbers): 2178 header(‘Content-type: text/html; charset=utf-8’); 2179 die(“EndAddField($field_json, \”$field_html\”);”); Next I am going to look into changing the .htaccess file for this system to see about editing the default content type which I think is causing the root of the error. Update Looks like the content type was a fix but it … Continue reading

Posted in Tech Tips | Tagged , | 3 Comments