php include returns 1 after content
You should use instead of include(‘thumbnail-break.php’);: get_template_part(‘thumbnail’,’break’); Which is the standard WordPress way of including partial template files from within page templates.
You should use instead of include(‘thumbnail-break.php’);: get_template_part(‘thumbnail’,’break’); Which is the standard WordPress way of including partial template files from within page templates.
Use TEMPLATEPATH for custom url
EDIT Undeleted my answer as the code seems to have helped the OP. Originally got beaten by @TomJNowell, so some content might be the same ORIGINAL ANSWER This is more PHP related than WordPress. Anonymous functions, the syntax used in the code given, was only introduced in PHP 5.3 and will not work in older … Read more
template_include is a filter – it takes one argument and it should always return a value (a template to include). Your function doesn’t do that. It doesn’t take any arguments and it returns value only if the condition is true – so if it’s not, it returns no value, so no template will be included … Read more
I think you meant to use: get_template_directory() Codex: Absolute path to the directory of the current theme (without the trailing slash). (link) instead of: get_template_directory_uri() Codex: Retrieve template directory URI for the current theme. Checks for SSL. (link) if you’re using include() for PHP code. But you should rather consider using: get_page_template() Codex: Retrieve path … Read more
Your endpoint is only applied to posts, add EP_PAGES to generate rules for page post type- add_rewrite_endpoint( ‘amp’, EP_PERMALINK | EP_PAGES ); That should also be within a function hooked to init.
You have a couple mistakes in your code: is_archive() does not accept any parameters is_archive() does not accept any parameters. If you want to check if this is the archive of a custom post type, use is_post_type_archive( $post_type ) Instead of using include( plugin_dir_path( __FILE__ ) . ‘my-template.php’);, use dirname( __FILE__ ) . ‘my-template.php’; Single … Read more
You can make use of the global $template which holds the complete path of the current template being use to display a page. From there you can manipulate the value to get the name of the template As example, the value of $template looks like this: (This is on my localhost on my PC) E:\xammp\htdocs\wordpress/wp-content/themes/pietergoosen2014/page-test.php … Read more