I think WordPress is one of the cases where the original code just got bigger and bigger without having a chance to be rewritten from ground up with best practices.
In this case, I think the WordPress conventional practice (writing markup in function) outweigh the best practices.
You might find the theme development documentation interesting to see the rules theme authors follow to develop themes:
http://codex.wordpress.org/Theme_Development
Related Posts:
- To close or not to close php
- Why do templates contain so many PHP tag pairs?
- Displaying a WooCommerce product via PHP
- What exactly does “Posts page” do in WordPress?
- Check if a menu is empty?
- WordPress Template Engine?
- Has anyone tried putting PHP ActiveRecord on WordPress?
- How to have a custom display for both woocommerce archive and product-category pages? [closed]
- wp_remote_get returns an error for valid URL
- Copyright info change in Theme Child PHP
- Blank on static home page?
- Add footer.php to WordPress child theme
- WordPress theme & site not loading after moving files
- I want to remove the links from the term list returned by get_the_term_list
- Adjust the results quantity for Search Results page pagination
- Exclude pages with certain template from wp_list_pages
- Categories Template Assistance
- Is it possible to use the featured image of a page as a css background without inlining?
- Can I view my own wordpress php source code on my hosted web server?
- Switching between custom templates in a post type of the admin menu
- Use template for posts with a particular category grandparent
- Placing the_content inside shortcode not working
- How to override wp-admin styling
- How to display php source code inside a post using visual editor?
- The custom logo, site title, and description doesn’t appear at the same time
- An unwanted inline style is added to my body tag
- stats_get_csv (WordPress Stats) to only display top posts (not pages)
- Automatically add custom CSS to new posts using a category template
- How to get the POST TITLE using the POST ID?
- How can I load a PHP page without using a Template?
- how could I load a different template part by page
- Get and insert order email address to the PHP template inside HTML text
- code is skipping a div
- Insert custom PHP head above in WP pages
- Woocommerce Show Single Product on Homepage
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- how to show only specific category for a template
- Does wordpress templates always in files or in database?
- Using same variable names in files added with get_template_part()
- How to do a code in php and have text before it? [closed]
- Create a Blog Template Page
- Showing latest post without 301 redirect
- PHP nested If statement syntax
- WordPress template page name displayed on screen
- Is there a way to hook or call a custom woocomerce template that is not part of the default templates of woocommerce?
- Display Data in Table from External Database in WP using Shortcodes
- How to call multiple functions from multiple files into a WordPress page template [closed]
- How do I define a lookup table that will work across all PHP elements of the template?
- persist a variable set in header.php all the way down to footer.php
- Why does the Woocommerce grouped template prints the unpublished products?
- Adding conditional text to a PHP Shortcode Template
- Advice on creating a WP Archive Template with Custom Taxonomy (get_term_meta)
- add_filter function concatenate string and locate_template function
- Template Loop – add switch case php
- Need help with pagination
- How can I get “Previous” and “Next” to show in the navigation besides the links?
- How do I query a single data value from the wp_metadata table?
- Splitting the_content() by size?
- Gravity Forms merge tags in templates?
- Unable to render custom field after attempt to generate a list of recent post in page template
- Accidentally deleted php code in WordPress website [closed]
- php loading different structure than source code
- random reason on refresh
- Some problems calling a function into sprintf() inside functions.php template file [closed]
- Insert PHP code in Text
- Loading Elementor templates in a Bootstrap modal on button clicking
- Woocommerce template file outputting tags
- Copying and pasting to WordPress “code editor” code via the front end and clipboard
- Require()/Include() post template adding extra content
- Display articles with a different template in the home page | Solved |
- What are the advantages/disadvantages of ways to use php template files?
- Change the “Show All” button in a WordPress Portfolio Filter
- Check if current post in loop is last on current page
- Converting Array to String Issue [closed]
- ACF – Custom image for Product Tags not displaying
- Roots Sage Symfony error when using override from template
- Displaying SQL query result from user input via wpdb
- How to display last whole post on the homepage
- admin-ajax.php 400 bad request – whats wrong with my code?
- What syntax is this? “{{post.price}}”
- Add point on excerpt post
- WooCommerce – Print Processing orders [closed]
- Loop returns more items than exist?
- Access methods in plugin template
- Create dynamic content from one WP page to multiple other pages
- Display pages from specific page template
- why is this content-template not showing any of my blog-entries?
- how to register a second page-template
- PHP code rendered in HTML
- Open all external links in new window – need help with the code
- If I define a variable in header.php, how do I make it available to templates?
- php “use” not working in template [closed]
- Loop on a wordpress Page instead of content coming from the WP text editor
- Where to put include php file?
- Can you not edit the HTML and PHP of your WordPress without paying?
- Dynamically added text at bottom of article – non searchable by PHP code
- How can one use variables in a template or template part without polluting the global scope?
- Need Help With Making Full-Width Template for Blog Posts (common methods aren’t working)
- how to create twitter card without plugin in wordpress website?
- WordPress post-template null warnings