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
- Can I run custom php on specific pages in wordpress?
- 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
- how to show only specific category for a template
- Can’t print Yoast meta description into page template (syntax error, unexpected ‘.’) [closed]
- Using same variable names in files added with get_template_part()
- How to do a code in php and have text before it? [closed]
- Add filter multiple times using only one master function
- Create a Blog Template Page
- Showing latest post without 301 redirect
- 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?
- single.php with different look by category
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Removing WordPress Footer -without access to PHP code?
- Adding conditional text to a PHP Shortcode Template
- Create page template via functions.php?
- how to display this functions?
- is_page_template showing partial results
- Adding regular php file to site
- add_filter function concatenate string and locate_template function
- Template Loop – add switch case php
- Post repeated when opening in overlay, how do I solve this? [closed]
- How can I get “Previous” and “Next” to show in the navigation besides the links?
- Splitting the_content() by size?
- using wp enqueue style to create a CSS file specifically for a page template
- 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
- pass html code to worpdress
- random reason on refresh
- Insert PHP code in Text
- Getting a WordPress tag to print inside of a traditional php echo
- Loading Elementor templates in a Bootstrap modal on button clicking
- Prevent header and footer from loading on specific pages with template or plugin
- Woocommerce display orders with products from specific categories to specific admins
- 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
- How to preload header logo image in WordPress? like what’s the code and where do I put it?
- Display metabox galleries on specific page template in admin editor
- Display WordPress archive template page in 3 columns and not 1 column [closed]
- Run do_shortcode on php template using JS function
- How to hardcode header and footer in WP?
- 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
- How to put 2 php codes in functions.php without site crashing
- Roots Sage Symfony error when using override from template
- Displaying SQL query result from user input via wpdb
- If is_page elseif is_page not working like I want it to
- How to display last whole post on the homepage
- admin-ajax.php 400 bad request – whats wrong with my code?
- My own theme’s custom widget areas are not working
- Add point on excerpt post
- WooCommerce – Print Processing orders [closed]
- Loop returns more items than exist?
- How to call a certain object/menubar in a PHP file
- Blog only showing code
- why is this content-template not showing any of my blog-entries?
- how to register a second page-template
- 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?
- How to get the Woocoomerce subtotal value without tax in the hardcode? [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?