Separate page for pagination possible?
Separate page for pagination possible?
Access to a data from a response AJAX called in a template file php
Separate page for pagination possible?
get_template_part() does not render after the ajax request
I have a custom WordPress REST API endpoint that returns the output of get_template_part Note that the REST API expects your endpoint callback to always return the response (e.g. the template part output in your case), and not echo it or anything else. And after the callback is called, the REST API will send some … Read more
You really shouldn’t be doing this. Functions belong in the functions file. Period. (Or perhaps in a separate functions file which you include in the main one) However, if you insist, you can drop functions in any template file you want, because PHP doesn’t care. Actually you will need to include it in every template … Read more
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.