William P. Davis
Forum Replies Created
-
Forum: Plugins
In reply to: [Docs to WordPress] Random Author AssignedHi Nadine!
The plugin should look for a username in WordPress that matches the username in docs. This works best with Google Apps. So if your email address is [email protected], you’d want your WordPress username to be me. In my case, my email address is [email protected], so my WordPress username is wdavis.
You can modify the default behavior in a few ways, though.
I should warn you these code snippets are untested, but they should get you pointed in the right direction.
You can set a default author for each post like so:
add_filter( 'pre_docs_to_wp_insert', 'dtwp_fix_author' ); function dtwp_fix_author( $post_array = array() ) { //Where post_author equals the ID of the default author $post_array[ 'post_author' ] = 1; return $post_array; }
At the BDN, we use a comment to override the default author. We simply leave a comment like this:
byline:username
You can do that if you’re using the clean extender like so:
add_filter( 'pre_docs_to_wp_insert', 'dtwp_byline_from_comments', 25, 1 ); function dtwp_byline_from_comments( $post_array ) { $comments = explode( "</span>", $post_array[ 'custom_fields' ][ '_gdocs_comments' ] ); foreach( $comments as $line ) { if( substr( trim( strip_tags( strtolower( $line ) ) ), 0, 7 ) == "byline:" ) $post_array[ 'custom_fields' ][ 'byline' ] = trim( str_ireplace( 'byline:', '', strip_tags( $line ) ) ); } if( !empty( $post_array[ 'custom_fields' ][ 'byline' ] ) && false != ( $user = get_user_by( 'login', $post_array[ 'custom_fields' ][ 'byline' ] ) && is_object( $user ) ) ) { $post_array[ 'post_author' ] = $user->ID; unset( $post_array[ 'custom_fields' ][ 'byline' ] ); } return $post_array; }
Let me know if you have any questions.
Forum: Plugins
In reply to: [Docs to WordPress] [Plugin: Docs to WordPress] Custom slugs not workingHey guys, thanks for your patience. This isn’t a standard feature of the plugin but I just posted something up to the dev blog on how to do it:
https://dev.bangordailynews.com/2011/12/22/setting-the-head-of-a-post-using-a-delimiter-in-your-doc/
Forum: Plugins
In reply to: [Zone Manager (Zoninator)] [Plugin: Zone Manager (Zoninator)] Example SitesThe plugin allows you to order content within a specific zone rather than displaying posts reverse-chronologically. It’s not plug-and-play — it requires template modification.
Once the plugin is installed, you can access the zones at /wp-admin/index.php?page=zoninator. You can search for posts and drag and drop them to order them.
Once you create the zones and add posts, you’ll have to modify your template. We have a template for the homepage that looks something like this:
$posts = $zoninator->get_zone_posts( $zone_id, array( 'numberposts' => 15, 'post_type' => 'any' ), false ); foreach( $posts as $post ) { //display post }
There are two ways you can do this.
One is to use the the Post Type Switcher, which allows you to switch a post to a page and vice versa. https://www.ads-software.com/extend/plugins/post-type-switcher/
The other option is to extend the Docs to WordPress plugin using the pre_docs_to_wp_insert filter. The plugin would look like this:
<?php /* Plugin Name: Docs to WP Pages */ add_filter( 'pre_docs_to_wp_insert', 'docs_to_wp_pages' ); function docs_to_wp_pages( $post_array = array() ) { $post_array[ 'post_type' ] = 'page'; return $post_array; }
I haven’t tested this, but it should do the trick.
Hmm, interesting, I haven’t noticed these two different strings. Can you give me an example?
Forum: Plugins
In reply to: [Docs to WordPress] [Plugin: Docs to WordPress] Job stopped workingPlease update to the newest version of the plugin and let me know if that fixes the problem.
Michael,
I just released a new version of the plugin. Can you upgrade and see if it changes anything?If you’re still having problems, please email [email protected].
This should be fixed in the newest version of the plugin. Sorry about that.
Forum: Plugins
In reply to: [Docs to WordPress] [Plugin: Docs to WordPress] Minor bugs in pluginThanks, I’ll take a look at these and merge them into the plugin.
FYI, I just pushed an update that should get rid of the upgrade requests.
Will
Forum: Networking WordPress
In reply to: Problems with Network Admin in 3.2@garyhenry:
The Network Admin can be found by clicking the down arrow next to ‘Howdy So-and-So’ in the upper right-hand corner.Forum: Plugins
In reply to: [Docs to WordPress] Docs to WordPress how does this plugin work ?I just posted an update to the BDN dev blog that should answer all your questions: https://dev.bangordailynews.com/2011/06/20/quick-update-to-the-docs-to-wordpress-plugin/
Forum: Plugins
In reply to: [Docs to WordPress] Docs to WordPress how does this plugin work ?This plugin allows you to easily move docs from Google Docs to WordPress, but it is in beta and not all the pieces are there yet. You’ll have to follow the instructions on the installation page or at the bottom of https://dev.bangordailynews.com/2011/06/16/marrying-google-docs-and-wordpress-or-really-any-cms/ in order to get it to work correctly. Images should come through fine as long as you don’t enable the clean content, strip comments extender.
Forum: Hacks
In reply to: Deprecated function: is_site_admin()Yeah, sorry, shoulda mentioned I was testing using trunk.