If the function returns a printed value:
<a href="https://wordpress.stackexchange.com/questions/145222/<?php bloginfo("url'); ?>">Link</a>
If not (using the echo statement):
<a href="https://wordpress.stackexchange.com/questions/145222/<?php echo get_stylesheet_directory_uri(); ?>">Link</a>
You can also use print()
as part of a more complex expression where echo cannot.
By the contrary, when you want to use HTML into PHP, I recommend to close PHP and open it again after the HTML code, instead of using echo "<a href="#"></a>";
like this example:
<?php my_function() { ?>
<a href="https://wordpress.stackexchange.com/questions/145222/<?php bloginfo("url'); ?>">Link</a>
<?php } ?>
Your PHP code is ok, but probably the function returns an empty value. Also, close the INPUT tag with />
.
Related Posts:
- Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- Conditional statement for parent, child and grandchild pages
- Unique key for each row in a repeater field
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- Advanced Custom Fields Image Field returning ID instead of URL [closed]
- Can an array be used as a meta_query value?
- ACF check if variable has http, if else return string
- Advanced Custom Fields: Post Object – Not returning data [closed]
- Looking for most performant way to execute several similar WP queries within shortcodes
- Trouble With Conditional Logic in PHP
- Importing hard coded custom field into acf field
- Strip characters, Including spaces, for tel: link
- How can I add multiple ‘tax_query’ arrays via a loop?
- ACF page while loop breaks footer while loop
- Change output based on text field value
- ACF: how do I get the fields and its values of a specific group?
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- Saving an array of dynamic repeater data as post_meta
- Output ACF repeater on frontend user’s profile page (created with Ultimate Member) [closed]
- Remove the first 5 characters of the_title and orderby that
- Unread Repeater field IMG alt not working
- Unable to write multiple values back to ACF user field – PHP
- Update grandchild repeater field with value per row
- How to use thumbnail size of image if I’m only using src to get image
- Slick + PHP + ACF + JQuery slide reveal not working
- Sort by page information by Ascending Numbers
- Advanced Custom Fields not displaying
- Download PDF after CF7 form submission
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- ACF put a comma after the last repeater field value [closed]
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Form search query – displaying ACF “Post Object” field as results
- Accessing values from ACF sub field (flexible content area) in PHP
- Creating an image from a custom field
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Get ACF options field in PHP acting as CSS
- Conditional multidimensional arrays and array_map
- ACF Repeater Pagination stopped working since upgrade to php7.2
- How can I count ACF sub_field with a certain value
- what is the method to echo class attribute inside the i tag? [closed]
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Show get_sub_field value if it exists [closed]
- Advanced Custom Fields [closed]
- ACF Unexpected T_CONSTANT_ENCAPSED_STRING [closed]
- Including Custom fields within the_content
- Get All In One SEO Pack to use custom field instead of Content
- Remove Post if Advanced Custom Field is checked to fix paging
- Update user repeater meta (ACF) with another user meta field value
- Display Post Title From Select Choice Loop in Advanced Custom Fields (ACF) – WordPress
- Foreach loop is unexpectedly outputting an extra empty a tag
- Delete images from media library when user deletes an image from ACF Gallery
- How to store checkbox data for individual users?
- Problems updating nested ACF field groups
- Get main parent category for post (WordPress/Advanced Custom Fields)
- ACF Taxonomy field values not select in backend
- If Statement is Ignored?
- Use WPQuery to match to specific repeater row in post
- Query on a repeater date (acf)
- ACF values to Script with auto refresh
- ACF relationship on user profile page used for allowed access
- ACF – Can’t get custom post type by taxonomy
- Advance custom fields variable with if statement & Function
- ElseIf Statement with ACF Group field
- Advanced Custom Forms PHP formatting for do_shortcode
- Possible to edit custom date field and display?
- Get field value and use as variable in php
- Place product field value as variable in php
- ACF Gallery field images donwload
- ACF – Get ID of relationship field in flexible content
- ACF under category name in shop page [closed]
- Get list of posts from attachment
- How to output values from a loop into a javascript array
- Pulling Products from an API
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- ACF background-color per post in a WordPress loop
- How can I copy an ACF field to AIOSEO field? [closed]
- Scheduling a post using publish date from a custom field. Resulting post is set as published in the future instead of scheduled
- Make sticky post with FacetWP
- Ordering / grouping posts by datepicker ACF
- PHP for loop not working as intended
- Position a repeated article blocks
- ACF + WP + Slick Slider Repeater Slide Group PHP not Displaying [closed]
- Else if Statement for Advanced Custom Fields [closed]
- ACF Images If/else
- Page returning ID from array, how to return the correct values for post in acf wordpress
- Sort by multiple options in custom field
- If or/and statement advanced custom fields [closed]
- Top menu disapears in Category Pages when filtering using ACF
- the_post_thumbnail unless video id is added
- get_category only returning details for ‘uncategorized’
- Add comma between variables [closed]
- Order woo products, but first products must be with acf fields
- ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?
- Custom WordPress Function – Adding items from Foreach Loop into an array and Updating Field based on array of IDs (ACF + WooCommerce)
- Show button in header when product custom field is not empty
- How can I get values from a custom post type depending on where I click on my SVG map?
- Creating posts with php-script + csv
- ACF number less than comparison not working