WordPress has an option to pick “Latest Posts” and “Static Page” under “Settings” in Admin Panel. My questions:
- What page template is getting loaded in each of those modes?
- Why
paged
stops working andpage
starts working when I select “Static Page” –paged
works, however, when I create new page template with new WP Query andpage
doesn’t work (this is about WP Query – I think that everyone knows what I’m talking about – it’s pagination). - 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 triedglobal $post
, yet). - 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?
Conditional Tags
is_front_page()
Conditional Tag returnstrue
if you’re on the Front Page (index.php
as fallback orfront-page.php
).is_home()
Conditional Tag returnstrue
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
orindex.php
as fallback).is_front_page()
andis_home()
will returntrue
forhome.php
,front-page.php
andindex.php
.Options
get_option( 'show_on_front' );
has the valuepage
.get_page( get_option('page_on_front') )
.get_permalink( get_option('page_on_front') )
.get_page( get_option('page_for_posts') )
.get_permalink( get_option('page_for_posts') )
.home.php
will not act as fallback forfront-page.php
.get_post_custom('page_on_front') )
.get_post_custom('page_for_posts') )
.… the list of AAARGH!!s goes on and on.
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. 🙂Before I answer that question (not enough time left today), I’ll just link you some track tickets, that show that the UI, function naming, etc. is highly questioned:
is_blog()
function and introducefront_page_url()
Yeh this thing is complicated to understand 🙁 codex can actually help here http://codex.wordpress.org/Creating_a_Static_Front_Page