A better, cleaner way to do this would be to use proper string return methods and concatenation. I say this, because you’re trying to put functions that echo content (i.e. the_title() into a variable – this won’t work!!!
Instead:
$text="<form><td>Permalink to: ";
$text .= get_the_title();
$text .='</td><textarea cols="85" rows="2" readonly="readonly" onclick="select()"/>';
$text .= get_permalink( $id );
$text .= '</textarea></form>';
Or, if you absolutely must have this in one long line:
$text="<form><td>Permalink to: " . get_the_title() . '</td><textarea cols="85" rows="2" readonly="readonly" onclick="select()"/>' . get_permalink( $id ) . '</textarea></form>';
Related Posts:
- What is the meaning of %s, %1$s etc.? [closed]
- Disable Attachment Pages Completely
- Include WP_Query in my own PHP file?
- Facebook Comment Count
- How to Remove Parents Category Permalink from Posts
- Add footer.php to WordPress child theme
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- Successful or Error Message after running mysql code in functions.php
- How do i get (unique) page name?
- How is WordPress manipulating the posts like there are folders?
- How to display posts of specific category using a custom Query in WordPress?
- Featured image fallback link to permalink
- The custom logo, site title, and description doesn’t appear at the same time
- Do changes to WordPress permalink custom structure affect old urls?
- Hide wordpress field if data is empty in post!
- How to get the POST TITLE using the POST ID?
- WordPress custom slug (endpoint) and compare all links
- Latest post in a specific menu
- Cause of Blank Lines Being Added to WP FIles?
- How to save checkbox values for logged in users?
- WordPress every page is 404 not found including admin resources
- WordPress returning 404 for multisite pages
- Create custom permalinks to show Custom Post Type’s relationship?
- Insert custom PHP head above in WP pages
- How to do a code in php and have text before it? [closed]
- Change product_base programmatically
- Divi change project category slug
- Custom post type permalinks do not appear using the link functions
- How to Handle Going Backwards in Navigation When Referrer in PHP/JavaScript won’t work?
- Remove slugs from custom posts type
- .html end of URl affected to SEO?
- using wp enqueue style to create a CSS file specifically for a page template
- how to edit a specific post slug using a php code?
- Accidentally deleted php code in WordPress website [closed]
- Creating a Category Taxonomy
- WordPress theme showing blank page
- random reason on refresh
- Permalinks: site.com/post-tite vs site.com/post-id/post-title for SEO and Speed
- Can not call .php files after switching to %postname%
- WordPress permalink issue
- Change permalink structure specific category
- Counting number of posts in multiple (sub)categories using shortcode
- Need help for some PHP code
- understand what code is doing when prepending /blog
- Custom URL for multiple categories hierarchy
- WordPress redirects to localhost
- 404 on old link after changing post url
- Woocommerce display orders with products from specific categories to specific admins
- Copying and pasting to WordPress “code editor” code via the front end and clipboard
- How to preload header logo image in WordPress? like what’s the code and where do I put it?
- url not using query string no longer working
- Custom PHP form needs refresh to load page correctly
- Child-Theme Category View with modified permalinks (%category% removed)
- How to put 2 php codes in functions.php without site crashing
- Get WordPress username to customize url
- Permalink doesn’t navigate to post (changes only url)
- Permalink changes after several minutes after saving post
- How to edit button permalink inside function.php using a child theme?
- How do I stop my form from adding code to current page URL instead of re-directing. Been stuck for days
- image on homepage disappeared due to change of permalink name
- admin-ajax.php 400 bad request – whats wrong with my code?
- Custom content using in_category
- style.min.css code issue
- How do I generate formatted permalinks as specified in backend options?
- 403 Forbidden Localhost Wamp Apache Php
- redirect 301 with special character like WIX site “#!”
- Permalinks and custom PHP application
- Some links broken after updating WordPress version
- add_rewrite_rule questions
- Weird slug in archives permalink
- WordPress Rewrite Issue
- Would it be possible to route WordPress Through an MVC Application
- Multiple URL from Custom post name
- Blog only showing code
- why is markup routinely placed in functions in wordpress?
- Themes with variable width or single columns? I want to display source code
- Get permalink for a post from inside WordPress and route to a related site
- custom data in url
- Open all external links in new window – need help with the code
- Make a permalink to the most recent blog post
- How to get the Woocoomerce subtotal value without tax in the hardcode? [closed]
- PHP code for link with text
- Remove /category/ from category (archive) page URLs (without using a plugin)
- Accessing WordPress Functions get_permalink() in Vanilla PHP?
- Where to put include php file?
- Can you not edit the HTML and PHP of your WordPress without paying?
- WordPress add parameters with friendly url structure
- how to goto specific page number including title with permalink
- How to extract URLs from wordpress taxonomies
- WordPress 6.1.1 UTF8 Slug Limit Increase
- Dynamically added text at bottom of article – non searchable by PHP code
- why css file not link?how to create permalink?
- how to create twitter card without plugin in wordpress website?
- How to automatically flush permalinks?
- Execute wp_after_insert_post after the permalink is customized
- WordPress CPT & Custom Taxonomy with the SAME Permalink Structure
- Modify the permalink structure for a specific category
- WordPress per ACF – permalink is not working
- Processing data and redirecting with query string
- I’ve added SKU to Woocommerce permalinks, but I have small issue