You don’t need to echo it. You can just add it to the string since we’re in PHP at that point:
'<span style="font-size: 16px;">' . esc_html( $student_name ) . '</span></span></p>'
You should also escape any variables you’re adding to HTML strings using esc_html() in case the strings contain HTML tags not just plain text.
Related Posts:
- start_lvl Ignored in Custom walker_nav_menu
- add_filter the_content str_replace after shortcode
- WordPress Ajax always returns a 404 error
- Adding a search form inside a div
- Load custom field value into div with AJAX
- How to use SRCSET with get_the_post_thumbnail()?
- How to use a frontend URL with a Plugin
- How do I make wordpress comment fields required?
- How to display blog images using wordpress in existing project
- WordPress Wysiwyg Content not being displayed
- Javascript code inside “” in core WordPress files .php
- How to display a value from a radio button in the options menu in wordpress
- How do I add HTML to a PHP function [closed]
- Custom image upload
- Slide in Panel WordPress Post
- Removing unneccessary p-tags (Not every p)
- WordPress automatically adding html tag around PHP code
- Missing sidebar parameter “fix” – before_content
- How to get the POST TITLE using the POST ID?
- Load a page into a div with Ajax
- My form action url is being prepended with a directory that does not exists
- Converting HTML Template to WordPress Theme
- Multiple options not staying selected after saving
- custom fields wordpress
- Why the JavaScript code is ignored from wp editor?
- How to change redirection route to a php page for making it only accessible by logged-in members?
- How to remove ?wp-mce-4103-20162941
- Why Won’t My Inputs in a form with a Get method work together?
- parts of url disappear when using # inside href=”” [closed]
- Dot is not added at the end of href
- Add .htm extention to a custom taxonomy
- Auto 301 to full post permalink? (using : /archive/%post_id% to %post_name% )
- Noscript not working as it should in wordpress site
- 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
- HTML escaping data with ajax requests
- 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
- HTML table attributes ignored
- wp_insert_post() with HTML tags using PHP
- How to rename woocommerce-billing-fields
- Prevent redirect to wp-login.php
- How to use the checked() function to check for a non-empty var
- Calling function in loop causes repeat data
- Remove   from the_excerpt
- Find out last 7 days of upload images, last week uploaded image from Gallery and display them in different pages
- Custom forms with HTML
- Wrap title and excerpt in a div (latest posts block)
- Displaying images outside the content
- 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 User Meta value variable into Google Gauge Chart
- WordPress Post Block Element not properly parsed with the_content filter
- Add other class content with reference class value
- PHP function for horizontal Woocommerce thumbnails and badges
- 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
- couldnt show short code atts in category
- separate list of programs in html/javascript coming from php
- 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
- WooCommerce multiple custom fields code
- How to override html codes in wordpress?
- 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]
- Create html tree sitemap
- Can’t get_users info by using json_encode
- scroll scrpit to particular button position to next id when click button
- Pass form attributes to another php template in wordpress
- Custom HTML form using PHP – help with ajax/username validation
- Code works on page-example.php by not category-example.php
- 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
- Parse error: syntax error, unexpected ‘}’ in
- 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
- How to modify default tags in wp_head()
- #038 & wordpress Help