if I create ‘front-page.php’, then how do I link to post index?

Since WordPress 4.5 you can use get_post_type_archive_link( ‘post’ ) to link to the page containing the blog posts. Depending on what you’ve set under Settings -> Reading, this will be either the front page, e.g. example.com/ or a specific page like example.com/news/. home_url( “https://wordpress.stackexchange.com/” ) always points to the front page.

How to target only the front page (not subsequent paginated pages) in theme/plugin?

You have a misconception about is_front_page(). Lets look at the source: public function is_front_page() { // most likely case if ( ‘posts’ == get_option( ‘show_on_front’) && $this->is_home() ) return true; elseif ( ‘page’ == get_option( ‘show_on_front’) && get_option( ‘page_on_front’ ) && $this->is_page( get_option( ‘page_on_front’ ) ) ) return true; else return false; } So from … Read more

Loop on front-page.php

This is how you would do it. You’re loop is based on being in an archive or index page. (or home) $args = array( ‘posts_per_page’ => 3, ‘post_type’ => ‘post’, //choose post type here ‘order’ => ‘DESC’, ); // query $the_query = new WP_Query( $args ); if( $the_query->have_posts() ): while( $the_query->have_posts() ) : $the_query->the_post(); get_template_part(‘loop’); … Read more

Performing a POST action on homepage goes to posts page

When posting a form, if you use ‘name’ as an input name then there seems to be a problem with submitting. Try changing: <input type=”text” name=”name” class=”form-contact__text” /> to: <input type=”text” name=”the_name” class=”form-contact__text” /> Also, best to give your submit button a more unique name in case it conflicts with any plugins/themes – then check … Read more

Pagination not Working on only Front page on latest verson of WordPress

this is proper working code for pagination on forntpage if ( get_query_var(‘paged’) ) { $paged = get_query_var(‘paged’); } elseif ( get_query_var(‘page’) ) { $paged = get_query_var(‘page’); } else { $paged = 1; } $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 8, ‘post_status’ => ‘publish’, ‘paged’ => $paged ); $loop = new WP_Query( $args ); … Read more

How to display thumbnail and excerpt of a page on homepage?

<?php $post_id = 50; // assign post id $queried_post = get_page($post_id); if(is_home()) { ?> <div class=”product_title”><h3><a href=”https://wordpress.stackexchange.com/questions/72514/<?php echo get_page_link($post_id); ?>”><?php echo $queried_post->post_title; ?></a></h3></div> <div class=”product_image_location”><?php echo get_the_post_thumbnail( $post_id); ?></div> <div class=”description_product”> <?php echo $queried_post->post_content; ?></div> <?php } ?>

is_home() in HTML head

both is_home() and is_front_page() works in the header or anywhwere you are using a theme template. Most likely, the problem is because you’ve hardcoded this: /wordpress/wp-content/themes/roots/style.php Try instead creating your url like this: <link rel=”stylesheet” type=”text/css” media=”all” href=”https://wordpress.stackexchange.com/questions/85053/<?php echo get_stylesheet_directory_uri(); ?>/style.php?tcount=<?php echo $count;?>” />

Setting a static home page and blog page without using the settings

The answer appears to be that it is possible: http://codex.wordpress.org/Creating_a_Static_Front_Page Configuration of front-page.php If it exists, the front-page.php template file is used on the site’s front page regardless of whether ‘Settings > Reading ->Front page displays’ is set to “A static page” or “Your latest posts,” the Theme will need to account for both options, … Read more