One post on frontpage and an archive page

Alter the main query for the front/home page with is_front_page() and/or is_home(), like shown below: add_action(‘pre_get_posts’,’wpse104878_alter_main_query’); function wpse104878_alter_main_query($query){ if ( is_admin() || ! $query->is_main_query() ) { return; } if( $query->is_main_query() && is_front_page() || is_home() ){ $query->query_vars[‘posts_per_page’] = ‘1’; } } The archive page should work, if underscore starter theme has an template for it. You … Read more

Using page template as Static Front Page

If you want the page to display your blog posts then you need to either change the front page reading option to latest posts then use either index.php or create a new file named front-page.php. If you want your page query ordered by menu_order you need to add ‘orderby’ => ‘menu_order’ to the query.

Set static page as default front page on newly created sites in multisite

Try the following code. Based on these two Q&A’s (not tested): How to add Custom Blog Options to new blog setup form? Programmatically set page_on_front add_action( ‘wpmu_new_blog’, ‘process_extra_field_on_blog_signup’, 10, 6 ); function process_extra_field_on_blog_signup( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { switch_to_blog($blog_id); $homepage = get_page_by_title( ‘Sample Page’ ); if ( $homepage ) { update_blog_option( $blog_id, … Read more

Reverse ordered pagination on home page

The default order of posts is date descending. To reverse it for home page you could hook into pre_get_posts and for is_home() query set order parameter to ASC. Note that that pages would still go from 1 ascending, they will just have posts on them in opposite order. I don’t think actually reversing order of … Read more

adsense code showing on random post thumb

Bit hard to understand exactly what you want to do as the grammar isn’t the best but i assume you want to return false for your Adsense widgets (using the code you linked to) when random posts thumbnail” plugin executes? You could add a check for the function your random posts thumbnail plugin uses so … Read more

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