Hot answers tagged

1

You are using get_stylesheet_uri() which links directly to your stylesheet, then your adding /style.css which is resulting in an invalid url. So you need to remove the /style.css. Or use get_stylesheet_directory_uri() and leave the /style.css on there.


1

has_tag() is a function that will check if a post has a certain tag You could integrate it into your code like so: function my_category_templates($single_template) { global $post; if ( in_category( 'raspee' )) { $single_template = dirname( __FILE__ ) . '/single-raspee.php'; } if ( has_tag( 'everyone' )) { $single_template = dirname( __FILE__ )...


1

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


1

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