You can use ‘echo’ (or ‘print’) to enclose HTML, but sometimes that gets a bit messy with complex HTML, not to mention having to escape quote/double-quote character.
So try something like this:
function myfunction() {
// after this next, plain HTML
?>
<div class="myclass"><h1 align="center">This is a heading</h1></div>
<!-- more HTML code here -->
<?php // back to PHP
// .. some more PHP stuff
return;
}
That allows you to put in some complex HTML (or a bunch of it) without having to use echo/print.
Related Posts:
- How do I change/modify the_post_thumbnail(); html output?
- Why do templates contain so many PHP tag pairs?
- How do I use Shortcodes inside of HTML tags?
- Why would a GET variable one one page of a site cause a 404 error when a GET variable works on another page of a site?
- Where should I install a PHP library into WordPress so that code in a webpage can activate it?
- WordPress Shortcode and Dynamic CSS
- Correct way to make static pages editable in wordpress
- How do I edit the php/html for a particular post?
- Nice scroll to wordpress
- Multiple pages on one with different HTML
- Is it ok to replace php code with html?
- Add custom HTML to posts page
- Minify HTML, CSS, JS with PHPWee?
- Header has extra HTML block at top before my code
- Blank space at beginning of tag?
- Add HTML Attributes To Anchor Tags In `wp_list_categories()` Function
- How to only show page id as body class?
- Shortcode content output but not in correct place
- Correct syntax to html php conversion
- How to properly insert a link to a template in WordPress?
- Show post in slider
- How can I hide Home in my menu in a specific page?
- Getting a specific post values to another div or modal
- Add a class to the anchor tag on HTML5 gallery
- how to remove metadata from the posts of my blog?
- How to store data from multiple forms using ajax and php
- search and replace preword from author
- WP grandchild categories in nested ul li
- Use DOMDocument with ob_start breaks my HTML code
- selected option if current category is the value
- Settings API callback function inserts html quotes from nowhere
- Input data from email form not going to JSON file
- Different post styles depending on category
- How create a Shortcode with hover and complex options
- How do I remove the product thumbnail link from a specific div in Woocommerce? [closed]
- WordPress Multiple Navigation bars
- Login to wordpress by clicking a link and specifying usernaname and password in url
- How do I add a custom css to all posts without affecting homepage css? [closed]
- Syntax error when I try to insert my loop into an unordered list? [closed]
- How to make modifications only to certain elements of an HTML string on the server-side?
- Printing HTML codes
- How to retrieve the data from the sever and displaying it in a page?
- How to execute html code inside php?
- Add data-id attribute to child page links
- wp_insert_post() with HTML tags using PHP
- Prevent redirect to wp-login.php
- How to use the checked() function to check for a non-empty var
- Remove   from the_excerpt
- Find out last 7 days of upload images, last week uploaded image from Gallery and display them in different pages
- Link to page with posts of specific type
- Custom forms with HTML
- Wrap title and excerpt in a div (latest posts block)
- how to changes mobile menu toggle breakpoint in WordPress
- PHP inside echo HTML
- html form: redirect page after form completes submit function and posts data
- WordPress Post Block Element not properly parsed with the_content filter
- Add other class content with reference class value
- What are the advantages/disadvantages of ways to use php template files?
- Configure WordPress to Use Responsive Image Rendering
- HTML comment cause issue in functions.php script root
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- Slug duplicates once clicking on link
- Remove span tags from WooCommerce Downloads page
- How to enable HTML tags in category description without breaking the category page
- Can’t display anything through homepage text editor
- How to find and delete a menu item in php?
- My single.php page skips the first div tag
- opens like sitename.com/URL
- WordPress Slider is not working
- How to display post meta bellow every posts
- Woocommerce custom attributes list help
- Access certain Entry in HTML-Table and pass the entry-data in WP not working [closed]
- Target a specific container to style on WordPress storefront theme
- Switch position of elements in the footer [closed]
- Can’t get_users info by using json_encode
- scroll scrpit to particular button position to next id when click button
- Code works on page-example.php by not category-example.php
- WooCommerce – Print Processing orders [closed]
- Add options to WordPress backend
- WordPress HTML Helper
- Automatically create a loop for post ID
- get_post_meta is always empty when I use wp_mail
- Save Option on Database
- Implement “No related posts for this entry” into the loop?
- ACF repeater image in video poster with jquery
- Advanced Custom Fields Show PHP in Text Areas
- Sorting Problem
- Custom HTML/CSS Theme into WordPress – SEO considerations
- Load wp_editor on button click
- How to enqueue structured data as file – jsonld file seems not to work
- Add topbar to static html page
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]
- Slick slider not working on wordpress
- Why do I get a 404 error on my custom post type archive pagination?
- change div text and link for logged in users
- Font Awesome Icons as squares [closed]
- How to modify default tags in wp_head()
- #038 & wordpress Help
- Editing stylehseet url in head section of WordPress
- How can we upload custom page files?