How can I make post fields required in WordPress?

Fairly simple using jQuery and global $typenow ex: add_action(‘admin_print_scripts-post.php’, ‘my_publish_admin_hook’); add_action(‘admin_print_scripts-post-new.php’, ‘my_publish_admin_hook’); function my_publish_admin_hook(){ global $typenow; if (in_array($typenow, array(‘post’,’page’,’mm_photo ‘))){ ?> <script language=”javascript” type=”text/javascript”> jQuery(document).ready(function() { jQuery(‘#post’).submit(function() { if (jQuery(“#set-post-thumbnail”).find(‘img’).size() > 0) { jQuery(‘#ajax-loading’).hide(); jQuery(‘#publish’).removeClass(‘button-primary-disabled’); return true; }else{ alert(“please set a featured image!!!”); jQuery(‘#ajax-loading’).hide(); jQuery(‘#publish’).removeClass(‘button-primary-disabled’); return false; } return false; }); }); </script> <?php } … Read more

Strategy for handling hierarchical pages with empty parent content

I am using two strategies here… 1) is simple redirection to first child (using menu order) page-redirect.php <?php /* * Template Name: Redirector * Description: Empty Holder (redirect page) */ $rp = new WP_Query(array( ‘post_parent’ => get_the_id(), ‘post_type’ => ‘page’, ‘order’ => ‘asc’, ‘orderby’ => ‘menu_order’ )); if ($rp->have_posts()) while ( $rp->have_posts() ) { $rp->the_post(); … Read more

Blog posts on one subdomain, pages on another

I might have a solution for you. First steps: Within your domain’s DNS manager you need to create a CNAME record. The name would be blog and the hostname would be your domain name. This is necessary because the browser needs to know where to point the subdomain blog.mydomain.com to; Second, you need to tell … Read more

Different number of posts in each category

As @StephenHarris pointed out there’s also the pre_get_posts filter. function hwl_home_pagesize( $query ) { if ( is_category( 9 ) ) { // If you want “posts per page” $query->query_vars[‘posts_per_page’] = 1; return; } if ( is_category( ‘movie’ ) ) { // If you want “showposts” $query->query_vars[‘showposts’] = 50; return; } } add_action( ‘pre_get_posts’, ‘hwl_home_pagesize’, 1 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)