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:
- start_lvl Ignored in Custom walker_nav_menu
- Why do templates contain so many PHP tag pairs?
- How do I use Shortcodes inside of HTML tags?
- What exactly does “Posts page” do in WordPress?
- Adding a search form inside a div
- WordPress Shortcode and Dynamic CSS
- Load custom field value into div with AJAX
- Blank on static home page?
- How do I edit the php/html for a particular post?
- How to use a frontend URL with a Plugin
- How to display blog images using wordpress in existing project
- Minify HTML, CSS, JS with PHPWee?
- How to display a value from a radio button in the options menu in wordpress
- Placing raw HTML inside a WordPress shortcode
- How to only show page id as body class?
- Shortcode content output but not in correct place
- An unwanted inline style is added to my body tag
- Show post in slider
- HTML tags in bloginfo description
- Transferring working local PHP site to wordpress – with database (MySQL)
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- Using the echo command adds unwanted br tags to source
- Use DOMDocument with ob_start breaks my HTML code
- Input data from email form not going to JSON file
- Different post styles depending on category
- Commenting out unwated CSS/scripts in HTML with PHP
- Show latest posts in a plain HTML website custom widget [closed]
- Search WordPress using static html page
- Hide HTML element (by class or ID) with PHP
- Path for php file for inserting data through html form
- Widget back end radio button issue
- How to remove coupon dropdown feature
- Add shortcode in my div
- Add html link in functions.php files of the theme
- PHP contact form not redirecting [closed]
- How to Schedule Cronjobs for start of every month and year
- Handling PHP/HTML inside the output of a shortcode function
- Highlight the links without using dropdown
- Illegal string offset error in wordpress theme options textarea
- Need help removing […] after excerpt
- Initial offset of number of posts in home page on the posts page
- Adding attribute to the post.php form tag in wp-admin
- WordPressUser Submission Form
- Shortcode displaying at the top of the page [duplicate]
- Is it possible to isolate and use WordPress functions outside of wordpress
- Time Delay a URL Redirect for Specific Page
- Cascading dropdown select search based on Parent Page & Child Page
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- Background image no longer fits to screen now that project is in php files
- Search bar for wp menu
- Adding HTML Code to Replace Text in PHP
- Executing php on button press
- Shortcode in Shortcode/HTML Graphics and Pictures
- I can’t go to the page archive-{post_type}.php
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- How to use wp_ajax_set_post_thumbnail?
- WP Website is shown in HTML
- Passing a value from an input field to a php function in WordPress?
- Use Search Term in html link and redirect
- Mysterious letters appearing at the top of a few pages
- Current WordPress Page Title as Search Parameter into A Tag
- If user has clicked link add class and store using PHP/WordPress
- HTML Formatting “single_term_title()”?
- How to Protect a private folder inside uploads folder, if User is not Logged In?
- Show subcategory name selected in specific category woocoommerce
- How to center all text body in single.php at once?
- sessionStorage saves input value in browser but it is not loaded in the form field
- Collapsible menu on post sidebar only expands and does not collapse
- Changable favicon
- How can I get my pagination loop to display the correct number of total pages?
- AMP version of e-commerce without plugin
- Use PHP to inject HTML into before page renders?
- How to make a parent page for author.php?
- Creating Log-In Page for backend server
- user update profile for custom code
- Vertical Menu for one page only
- Bootstrap Carousel Indicators Won’t Cycle On Custom WordPress Theme
- Multisite – Display different header content based on which site is accessed
- Show post/page into div using function
- wordpress, Category ID
- html to posts, jpg to featured image, zip file contains jpg and html
- How do you change the tag font size in the repeater-template.php [closed]
- PHP tag in post content makes wordpress go crazy
- How to only fetch certain Tag ID’s
- Where to find the html for WordPress site? [closed]
- RegExp to EXCLUDE strip HTML (FOR SOMME) comments
- Pagination for div’s
- wp nav menu without label
- Pass the updated value of aid from form using ajax
- Show contact 7 form in popup
- How Can I Center the Logo in the Navigation Menu? [closed]
- nested divs, classes for a grid in loop [duplicate]
- Arrange Category post manually when displayed
- HTML in PHP problem [closed]
- How to customize posts in WordPress by using HTML and CSS?
- WP_Query not returning results
- Header location [closed]
- How do I link the side images?
- Remove post image caption from post_excerpt();
- How to create different templates for woocommerce single-product.php?