How to conditionally add Custom Post Type to Front Page

I believe that if all your products have the custom meta field show_on_front_page with some containing ‘1’ and some containing ‘0’ or some such, AND your regular posts do not have that field, then something like below should work: //… $query->set(‘post_type’, array(‘post’, ‘product’)); //add this $meta_key = ‘show_on_front_page’; $query->set(‘meta_query’, array( ‘relation’ => ‘OR’, array( ‘key’ … Read more

Front Page Settings

I am not sure why you need pages over posts here. Using posts gives you ready made index home page, slugs and pretty permalinks give you link structure you want. You can just add some blurb on home page that says “bookmark this puzzle” with direct permalink.

Using front-page.php need new blog page

To use a static Front Page, you need to do the following: Create two static Pages, one for your front page content, and one for your blog posts index; their names are entirely arbitrary, but for our purposes, let’s call them “Front Page” and “Blog” Go to Dashboard -> Settings -> Reading Set “Front Page … Read more

Best Practice for Displaying Categorized Posts on Front Page

You can use WP_Query in your template to select groups of posts by type, category, tag, custom taxonomy, meta field, etc., and create additional loops: <?php $news = new WP_Query(“post_type=mynews&posts_per_page=1”); while($news->have_posts()) : $news->the_post(); the_title(); endwhile; $events = new WP_Query(“cat=2&posts_per_page=3”); while($events->have_posts()) : $events->the_post(); the_title(); endwhile; // etc.. It’s up to you how to best organize your … Read more

NON Static-Front Page

Note that when in context of WordPress “static” front page does not meant static literally. Usually it means page with certain content that stays same, as opposed to index/archive pages primarily filled with multiple posts that move with time. So whatever dynamic functionality can be added to appropriate template being used for “static” front page … Read more

dynamic sidebar in front page

loop-page.php is the wrong context for what you are trying to do. If you want it to appear on the home page, then you need to edit loop.php, so in your child theme you can either create a file called, loop.php …which should take precedence over the loop.php found in the parent TwentyTen theme or … Read more

Restrict query to last day with posts

You need to find the most recent date with posts and use that to construct the $current_ fields. $last_date = $wpdb->get_var(“SELECT DATE(MAX(post_date)) FROM {$wpdb->posts} LIMIT 1”); if (!empty($last_date)) { list($current_year,$current_month,$current_day) = explode(‘-‘,$last_date); query_posts( “cat=5&year=$current_year&monthnum=$current_month&day=$current_day&order=ASC” ); }

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