Add this to your functions.php
or your plugin.
add_filter( 'get_the_excerpt', 'shortcode_unautop');
add_filter( 'get_the_excerpt', 'do_shortcode');
add_filter( 'get_the_excerpt', 'do_shortcode', 5 );
I’ve been working on a project and wanted to test out accessing media from a different domain using CORS. There’s two steps to this. Make sure you have Apache mod_headers enabled. Use apachectl -M on the command line interface and review the results. It should include something like this: headers_module (shared). If not then run … Continued
Add this to your functions.php
or your plugin.
add_filter( 'get_the_excerpt', 'shortcode_unautop');
add_filter( 'get_the_excerpt', 'do_shortcode');
add_filter( 'get_the_excerpt', 'do_shortcode', 5 );
$sub_fields = array( array('GROUPFIELDNAME' => array('GROUPSUBFIELDNAME' => $GROUPSUBFIELDVALUE), 'acf_fc_layout' => 'FLEXIBLECONTENTNAME') ); update_field('field_59778f7a4af43', $sub_fields, $post->ID);
Exporting from Drupal Use Views Data Export module and these instructions. When exporting tags there’s a couple options. 1. You can have all the added tags in one field value. 2. You can export each taxonomy individually. Depending on how you want the tags within the WP site you may prefer one way or another. … Continued
First off, don’t do this (also, say that post title 10 times fast; r/titlegore). It’s better to not have to write logic into an app so that two things can see the same data from different parts of the db. It should be stored only in one spot and referenced from there. However, within a … Continued
When adding rewrite rules with add_rewrite_rule add this to the file you are editing and avoid clicking save on the permalink settings page. // do not use on live/production servers add_action( 'init','maybe_rewrite_rules' ); function maybe_rewrite_rules() { $ver = filemtime( __FILE__ ); // Get the file time for this file as the version number $defaults = … Continued
I’m currently setting up an admin for a clients redesign. There’s going to be a hefty amount of categories and I wanted to make the selector in the sidebar resizable for at least a little bit easier viewing.
The simple if not completely cross browser friendly (chrome, ff, safari) way to do this is css’s resize
.
/* #talent-categoriesdiv is the .postbox the parent box */
.wp-admin #talent-categoriesdiv .inside{
/*set an initial height, otherwise it will expand to show all rows*/
height: 300px;
resize: vertical;
overflow: scroll;
}
.wp-admin #talent-categoriesdiv .categorydiv{
height: 100%
}
.wp-admin #talent-categoriesdiv .tabs-panel{
height: calc( 100% - 78px );
max-height: unset;
}
I’m currently working on a site redesign/development for the painter Stone Roberts.
There isn’t anything to be seen as of yet, but there is a Github repo I’ll keep updated as I go along.
More info can be found on it’s project page.
Had an issue where a clients blog post had one of these in the post and it wasn’t being displayed right. The real issue was changing the ‘post_content’ field of the wp_posts table to UTF-8 Unicode (utf8mb4) from cp1252 West European, but (!) along the way I tried this. Put this in a plugin or functions.php and … Continued
<?php // Add Browser-Detection function mv_browser_body_class($classes) { global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone; if($is_lynx) $classes[] = 'lynx'; elseif($is_gecko) $classes[] = 'gecko'; elseif($is_opera) $classes[] = 'opera'; elseif($is_NS4) $classes[] = 'ns4'; elseif($is_safari) $classes[] = 'safari'; elseif($is_chrome) $classes[] = 'chrome'; elseif($is_IE) { $classes[] = 'ie'; if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $_SERVER['HTTP_USER_AGENT'], $browser_version)) $classes[] = 'ie'.$browser_version[1]; } else $classes[] = 'unknown'; if($is_iphone) $classes[] = 'iphone'; if ( stristr( $_SERVER['HTTP_USER_AGENT'],"mac") ) { $classes[] = 'osx'; } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'],"linux") ) { $classes[] = 'linux'; } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'],"windows") ) { $classes[] = 'windows'; } return $classes; } add_filter('body_class','mv_browser_body_class');
“Many of the projects that we onboard come with crippling performance issues that make their WordPress sites slow, resource-hungry and incapacitated under load. Today we’ll look at another common problem that we often see – PHP Sessions.”
I was recently (I always seem to start posts with that phrase) learning how to update a clients posts post_title, slug (aka post_name in the db) and guid when a post title was changed programatically. I was using get_sample_permalink() in combination with wp_update_post() to generate a permalink and update the post guid along with the … Continued
I was working on a clients Dreamhost VPS server and received an error: Sorry, there has been an error. Failed to write file to disk.. That’s not something I’ve come across before. Some googling didn’t turn up much but this InMotion hosting support page did mention a full /tmp dir. A look at the php … Continued
By default in WordPress when an author of a post comments on their own posting the comment is automatically approved. This makes sense when authors are associated with the site, have access to admin, etc. There are cases where content from the general public is used to create posts and while the user is logged … Continued
Contact Form 7 has a filter where one can alter the messages being sent back to the browser called wpcf7_validation_error. A simple htmlspecialchars_decode altering the $message variable before returning will do the trick. This function will run on any error for any form you have in your site (any CF7 form that is). If you … Continued
While setting up this site I noticed some files not found errors in dev console. One was devicepx.js which was in the jetpack modules path. It’s used to optionally load retina/HiDPI versions of files. I believe it would be for gravatars and since this site doesn’t use gravatars I deemed it unnecessary. //remove unecessary queing … Continued
I recently needed to use posts with a heirarchal structure (like pages have by default) and ran into an issue where posts still in the draft and pending stage could not be added as a parent. This would not do as I was publishing a set of posts where I wanted more than one to … Continued
In the file wp-includes/class-wp.php there is a hook run which is simply named 'wp'. This, as far as I can tell, seems to be the earliest hook in which the $post object variable exists. The hook is passed the &$this object which the comments state: references the WP object. It allows for accessing the properties … Continued