How do I update the SEO information on dynamic pages being generated from template_include?
How do I update the SEO information on dynamic pages being generated from template_include?
How do I update the SEO information on dynamic pages being generated from template_include?
Should I use include(_once) or require(_once) for loading php-file with customizer settings?
I tried this in a fresh install of WP locally so I’d assume this is expected behavior, but I don’t understand it. I’m not in the loop, No but that doesn’t mean a main query doesn’t exist, it just means your code to display it hasn’t run yet and I haven’t called anything to start … Read more
$get_file_content = fopen(TEMPLATEPATH . ‘/mail/create-account-member.php’, “r”); // Lê cada uma das linhas do arquivo while(!feof($get_file_content)) { $message .= fgets($get_file_content) . “<br/>”; } fclose($get_file_content); wp_mail( $user_email, $subject, $message, $headers );
While there are some WP–specific solutions that track template files, for complicated projects pretty much the only reliable list is using get_included_files() PHP function at the end of page load. It would give you everything, including WP core, but filtering it down to theme is relatively easy.
Using require_once for parent-directory not working but is working in sub-directories
Must be something with your setup. Following works for me (inside child theme – should work for any theme though): single.php: global $post; $bla = $post->post_title; error_log(‘post title is: ‘ . $bla); include(‘included.php’); included.php: error_log(‘i am included file: ‘ . $bla); Output in debug.log: post title is: Hello test i am included file: Hello test … Read more
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.
Thanks to @WebElaine’s comment. I needed to move the template return outside of the function so that it looks like this: public function add_my_template($template){ if ( is_page( ‘my-unique-page’ ) ) { $template = plugin_dir_path( __FILE__ ) . ‘page-my-unique-page.php’ ; } return $template; }
How to add variables to a template