What are the differences between “Latest Posts” and “Static Page”?

WordPress has an option to pick “Latest Posts” and “Static Page” under “Settings” in Admin Panel. My questions:

  1. What page template is getting loaded in each of those modes?
  2. Why paged stops working and page starts working when I select “Static Page” – paged works, however, when I create new page template with new WP Query and page doesn’t work (this is about WP Query – I think that everyone knows what I’m talking about – it’s pagination).
  3. It looks like get_post_meta($post->ID, "my_custom_field_name", true) stops working when I select custom page template as “Static Page” but the same thing works when I use it via standard “View Page” in Admin Panel (I haven’t tried global $post, yet).
  4. I think that all my above questions are related to what gets inside $wp_query and $post in each of those modes.

I just don’t get these two options 🙂 Can someone provide me some guidance or resources where I could find out more about it?

Related posts

Leave a Reply

3 comments

  1. Conditional Tags

    • The is_front_page() Conditional Tag returns true if you’re on the Front Page (index.php as fallback or front-page.php).
    • The is_home() Conditional Tag returns true if you’re on the Front Page, when you got no static page set as front page, or when you got a static front page and display the Posts Page (home.php or index.php as fallback).
    • If you got no static front page set under “Settings > Reading”, then both is_front_page() and is_home() will return true for home.php, front-page.php and index.php.

    Options

    • If you got a static front page, then get_option( 'show_on_front' ); has the value page.
    • To retrieve the ID for the Front page, you can call get_page( get_option('page_on_front') ).
    • To retrieve the link to the Front page, you can call get_permalink( get_option('page_on_front') ).
    • To retrieve the ID for the Posts page, you can call get_page( get_option('page_for_posts') ).
    • To retrieve the link to the Posts page, you can call get_permalink( get_option('page_for_posts') ).
    • If you have a child theme, then home.php will not act as fallback for front-page.php.
    • To retrieve custom values from the Front page, you can call get_post_custom('page_on_front') ).
    • To retrieve custom values from the Posts page, you can call get_post_custom('page_for_posts') ).

    … the list of AAARGH!!s goes on and on.

    especially when user tries to set custom template as “Static Page” – pagination stops working unless I use page and custom fields stop working unless I create new WP Query.

    From a comment of the OP to another answer

    As you can see in this diagram, it’s not that easy to get around what to use where. The problem is that there’re functions that intercept the main $wp_query object, others that copy over the contents of the $wp_the_query object, etc. And than there’re those that only work with the main $wp_query object. I know this is no full answer to your pagination question, but this also has never been the question. 🙂

    1. you basically select two templates, one for the front page and the other for the blog page. It is kinda hard to understand from your question to which one of them your questions refer…
    2. The page template associated with the static page you selected there. The latest posts page will ignore the template setting and will use the templating instructions from home.php or index.php.
    3. Because a page content is not paged ;). The latest posts page should be paged, at least on my test installations it works fine.
    4. Need to see the exact code, but $post is global, it is better to always declare it as one instead of assuming that your code is not being executed from a function and therefor doesn’t have access to the global scope.
    5. For the static home page they will contain the same values as if you try loading the page by its own URL. For the latest posts the should contain the same values the would have contained if you were loading the home page before messing with the static page configuration.

    Yeh this thing is complicated to understand 🙁 codex can actually help here http://codex.wordpress.org/Creating_a_Static_Front_Page