Query sub subpages based on specific date?

If you’re loading additional posts/pages, it’s better to use a new WP_Query instance. query_posts is only for modifying the main query. As for the dates, store them in a custom field in the format yyyy-mm-dd. You’ll use php’s date to get the current date, refer to WP_Query’s custom field parameters for how to query and … Read more

PHP Fatal error when using plugin_basename

I’ve encountered this issue a few times before. It’s a simple matter of adding this to the top of your plugin beneath the comments block. It appears that the way plugin_basename returns the value doesn’t play nicely with much else. $basename = plugin_basename(__FILE__); Then replace this line: define( ‘SEND_INVITATION_PLUGIN_BASENAME’, plugin_basename(__FILE__) ); With this instead: define( … Read more

Loop output for custom plugin [solution found]

The Solution to my problem is to simply let my plugins output run through the do_shortcode()-Function of WordPress as pointed out by this article: Using Shortcodes Everywhere I updated my plugin so it uses shortcodes, too, so now my output looks like this: // Add this upon plugin initialization add_shortcode( ‘dosomethingawesome’, array( &$this, ‘output_callback’) ); … Read more

WordPress Related Plugin – Adding an image

Have worked it out and have the following code: <?php $rel = $related->show(get_the_ID(), true); foreach ($rel as $r) : echo ‘<a href=”https://wordpress.stackexchange.com/questions/44075/.get_permalink($r->ID).”>’.get_the_post_thumbnail($r->ID, array(50,50)).'<div class=page-related-title>’.$r->post_title.'</div>’.'</a>’.'<br />’; endforeach; ?>

Control Category of each user can post

I actually have a plugin that does just that, it adds a category dropdown to the user profile edit: Only user who can manage_options (admin) can see that field. and once the user is logged in to post he sees this: Update Its now in the plugin repository http://wordpress.org/extend/plugins/author-category/ enjoy.

Failed Media Import (importing from LIVE to local)

I had the same problem today and the client just gave me his login credentials… The WordPress Import plugin is a…well.. If you don’t have a ftp account to grab the data, you can use a plugin like “WordPress Backup to Dropbox” to get the data ( there are other plugins which export to other … Read more

How to Insert A List of Posts in A Category Written by the Author into the Author Archive

Not the most efficient way but it works, put this in your theme’s functions.php function author_post_breakdown($author_id){ //get all post of this author $n = get_posts(array( ‘author’ => $author_id, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’ ) ); $cats= array(); //loop over all post of this author and get the categories for each post foreach((array)$n as $id){ … Read more

Gallery Shortcode Function Help

The function you’ve supplied actually doesn’t look that bad. It’s almost the same way I’d handle the problem, however if you only ever want to modify the include part and always get the attachment_ids associated with the post, here is what I would do. I would actually create a new shortcode which in turn calls … Read more