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:
- How to get URL of current page displayed?
- What is the meaning of %s, %1$s etc.? [closed]
- Disable Attachment Pages Completely
- Include WP_Query in my own PHP file?
- how to get permalink structure with php
- Facebook Comment Count
- Has anyone tried putting PHP ActiveRecord on WordPress?
- Copyright info change in Theme Child PHP
- How to Remove Parents Category Permalink from Posts
- Add footer.php to WordPress child theme
- I want to remove the links from the term list returned by get_the_term_list
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- Can I run custom php on specific pages in wordpress?
- Successful or Error Message after running mysql code in functions.php
- Can I view my own wordpress php source code on my hosted web server?
- How do i get (unique) page name?
- Put a link to a category round a hard coded A HREF
- How is WordPress manipulating the posts like there are folders?
- How to display posts of specific category using a custom Query in WordPress?
- wordpress upgrade has broken my permalinks
- Featured image fallback link to permalink
- 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
- Do changes to WordPress permalink custom structure affect old urls?
- stats_get_csv (WordPress Stats) to only display top posts (not pages)
- 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
- Add prefix to link url
- Latest post in a specific menu
- Cause of Blank Lines Being Added to WP FIles?
- 200 Rewrite blog post links
- How to save checkbox values for logged in users?
- php script to change slug in post automatically
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Changes in permalink structure in WordPress and how to apply to in-site links
- WordPress Persistent connection rule does not work for “posts”
- WordPress every page is 404 not found including admin resources
- WordPress returning 404 for multisite pages
- How to use $_GET function WordPress backend
- Create custom permalinks to show Custom Post Type’s relationship?
- Insert custom PHP head above in WP pages
- 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
- What is the proper way to call a function (from functions.php) on a link click?
- 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
- How to solve 404 permalink errors on nginx server
- Some links broken after updating WordPress version
- add_rewrite_rule questions
- how to run a php code in widget?
- Weird slug in archives permalink
- WordPress Rewrite Issue
- Would it be possible to route WordPress Through an MVC Application
- how to add number value in front for variable [closed]
- Newly published content gives 404 on wordpress
- set new link as permalink
- Multiple URL from Custom post name
- echo variable containing html and the_permalink();
- Blog only showing code
- Display pages from specific page template
- append links with unique number string
- why is markup routinely placed in functions in wordpress?
- get_permalink returning first letter
- 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
- Add any username as link prefix and show data from that specific user’s profile on wordpress pages – with no login required
- 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
- Remove slug of multiple custom post types with and without hierarchical
- Modify the permalink structure for a specific category
- change the blog in the url if you go from a specific page wordpress
- Is it possible to go to the next post in the same 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
- Post returns 404 after changing the permalink using post_type_link
- Cannot access the other pages after successfully editing post type