Hot answers tagged functions
Using an URL to include a php file will usually not work. You will need a filesystem path. Depending on where you .php file is located (in this case the template directory), you could use: include( get_template_directory() . '/myfile.php' ); https://codex.wordpress.org/Function_Reference/get_template_directory
Sure. In your single.php or where you loop through the posts, start by getting the content: $content = get_the_content(); Then use a regex where you target anything within <h2> tags: $regex = '/<h2>(.*?)\<\/h2>/u'; And then use preg_match_all() to find all titles: preg_match_all($regex, $content, $table_of_content); This will ...
Only top voted, non community-wiki answers of a minimum length are eligible