For a WordPress theme to work, it really needs one template: index.php. But, using that file for all types of content is not really a good idea, since it limits the way content is displayed. Because of that, WordPress has a template loader, and this loader uses query (based on query string) that generates content for display to determine what template to load. Basic template hierarchy supported by WordPress can be found here: http://codex.wordpress.org/Template_Hierarchy But, in some cases, this is not good enough, and you will need finer templates separation to avoid writing complex conditionals for displaying the content. To […]
About Milan Petrovic
Founder of Dev4Press , dedicated to development for WordPress, focusing on premium plugins. Dev4Press website offers wide selection of practical tutorials for WordPress. Milan is author of many popular WordPress plugins, including GD Star Rating, GD Press Tools and GD CPT Tools. Milan also developed several plugins for bbPress for WordPress powered forums: GD bbPress Toolbox.
When it comes to protecting content and limiting it’s visibility, WordPress has only one feature: setting password for individual posts. But, if you need to hide parts of the content, or to display different things to different users, you need custom build solution. This WordPress tutorial will show you how to build shortcodes you can use to hide parts of the post content depending on three criteria: user login status, user roles and user capabilities. At the end, you can download the finished plugin with the shortcode. Shortcode Attributes Shortcodes will have 3 attributes for each criteria, 2 extra attributes […]