Is it possible to set a custom post type template with code?
Is it possible to set a custom post type template with code?
Is it possible to set a custom post type template with code?
Use setup_postdata() to make the ‘current post’ any given post, then retrieve the template part before resetting post data back to the original post. Any template tags that depend on the current post in The Loop that are in the template part will refer to the post you have set up with that function. function … Read more
There are several possible things affecting your gallery. The first most basic one is WordPress Core itself. The gallery shortcode is created in /wp-includes/media.php. If you had a default theme and no plugins, that would be controlling it. However, the behavior you describe is being added, either by a theme or a plugin. A theme … Read more
If you’re editing the theme directly it might be because of an update, when a them updates it deletes all the changes you have made on it. If you want to edit themes you have to create a child theme Just create a folder next to your actual theme folder (wp-content/themes) with the name you … Read more
get_users by role returns all users
You can still use the options in the old post you linked to. If you’re already using a custom or child theme, you can also edit functions.php and add your custom JS wherever the main theme scripts are enqueued. For me personally it makes things simpler to add all theme CSS and JS in the … Read more
Custom Template doesn’t output result when set as homepage
Template and URL parameter problem
HTML is output either by your theme or your plugin. So first what you need to do is understand WP’s template hierarchy. If you’re having trouble following the hierarchy and you need a code snippet to figure out which template your page is using (it sounds like you’re talking about a WP Page?) you can … Read more
If I am understanding you correctly you could use get_page_template_slug(). For example… <?php echo get_page_template_slug( $post->ID ); ?> Although, to be honest I don’t see the point of doing this over using body_class().