First post outside of loop, homepage only?
try and add this before your code: <?php if ( have_posts() && is_home() && !is_paged() ) : ?> <?php the_post(); ?> <?php get_template_part( ‘content’, get_post_format() ); ?> <?php endif; ?>
try and add this before your code: <?php if ( have_posts() && is_home() && !is_paged() ) : ?> <?php the_post(); ?> <?php get_template_part( ‘content’, get_post_format() ); ?> <?php endif; ?>
Every theme is different – there is no standard way of naming (or even using) a template part. You would be better off using your own markup and default styles, but allow theme authors to override it with hooks & filters.
It the template is called via get_template_part(), then it is in a new variable scope. to access it, you have to use the global keyword in you template file: global $foo; echo $foo; As header.php probalbly is also called in a function scope, you have to make sure there the variable is used in global … Read more
I’ve created a new file, specified the encoding as “UTF-8” and retyped everything by hand – no copy/paste from the old file. Took a while, but all works now. It must have been some encoding errors playing up. Thanks to everyone who helped: @t31os, @kaiser, @Chip Bennett
Can you be a little more specific on which part is ‘leaking’ into the body? It’s hard to tell without running any code and having other parts of the theme to look at.
In the Twenty Ten theme they are using a file called loop.php. It defines the loop for different page templates and defines theme accordingly inside loop.php. That’s what allows them to use get_template_part. Depending on your theme and how it’s set up will determine how to go what your asking. If all of your pages … Read more
Just looked in the P2 theme files. The theme loads the entry.php with the function p2_load_entry() located in inc/template-tags.php. If you want to edit the entry.php file and want to be on the safe side if P2 releases an update, you should create a Child Theme. Create a new sub-folder inside wp-content/themes/ e.g. p2-child Inside … Read more
the answer is yes, yes i can. do love it when i find the answer w/in minutes of posting here. add_action(‘template_redirect’, ‘my_template’); function my_template() { if ( is_tax() && in_array(get_query_var(‘taxonomy’), get_object_taxonomies(‘product’) ) ){ include (get_stylesheet_directory(). ‘/product_taxonomy.php’); exit; } }
query_post while (have post) get_template_part()?
You can try to store $wp_query in a cookie or in a session variable. global $wp_query; setcookie(‘my_wp_query’, $query_string); or global $wp_query; $_SESSION[‘my_wp_query’] = $query_string; and use that in you ajax function.