template_redirect for single posts w/ custom fields

The problem with your code is that you’re checking is_single() when your plugin is first loaded, before the global query has run, so is_single() still returns false. You should move the is_single() check within your my_template function: function my_template() { if(is_single() && have_posts() && ‘Custom’ == get_post_meta(get_the_ID(), ‘Design’)) { include(PLUGINDIR . ‘/supersqueeze/all.php’); exit; } } … Read more

What is the difference between these two methods of writing $ instead of jQuery in WordPress [closed]

The first is a pattern called a closure. It’s not unique to jQuery. You could just as easily write (function(someVar) { // Inside the closure, someVar == “test” })(“test”); Basically, you’re manually passing jQuery into the closure by referencing the jQuery object externally and aliasing it to $ inside the context of the closure. The … Read more

How to put placeholder text in the main post input area?

You can change ‘post’ to which ever post type you want to apply the default content to. add_filter( ‘default_content’, ‘wpse57907_default_content’, 10, 2 ); function wpse57907_default_content( $content, $post ) { if ( ‘post’ == $post->post_type ) $content=”Use this area to write an introduction to the course…”; return $content; } Edit I’m not sure you can add … Read more

Add Additional File Info (jpeg compression & file size) settings to Edit Images Screen

You can try to use the attachment_submitbox_misc_actions filter to add more info to the box. Here is an example for the filesize part: add_action( ‘attachment_submitbox_misc_actions’, ‘custom_fileinfo_wpse_98608’ ); function custom_fileinfo_wpse_98608(){ global $post; $meta = wp_get_attachment_metadata( $post->ID ); $upload_dir = wp_upload_dir(); $filepath = $upload_dir[‘basedir’].”https://wordpress.stackexchange.com/”.$meta[‘file’]; $filesize = filesize($filepath); ?> <div class=”misc-pub-section”> <?php _e( ‘File Size:’ ); ?> <strong><?php … Read more