Why do you want to put your code between the braces in the_content()
? What are you trying to accomplish?
Maybe this solves your problem?
<?php
$custom_attach = get_post_meta( get_the_ID(), 'wp_custom_attachment', true );
$name="button";
if(!empty($custom_attach)) {
echo '<span class="icon-download">';
echo '<a href="'.$custom_attach['url'].'">'.$name.'</a>';
echo '<span>';
}
the_content();
?>
This echoes the <span>
-element with the class icon-download
first, and then the content of the post.
Related Posts:
- Difference between the_content() and get_post()?
- Insert Ad Code in the Middle of a Post
- get_the_excerpt() not returning anything when post has no excerpt
- Function to wrap the_content in a div
- Function to show only first instance of shortcode
- Automatically insert php function into post $the_content
- Searching for content post
- str_replace function in theme
- Adding HTML to the end of every post with the Block Editor
- Inserting a functions output after the content
- Add caption functionality to custom WordPress theme
- Removing permalink from post thumb in twentyeleven
- Add Element as a Filter to the_content
- Insert template-part inside the content
- Remove links from the_content when using filters wp_trim_excerpt
- How do I pull excerpts from pages?
- Undefined variable error in new function
- How to remove a specific word at the beginning of the content and add it to the end of the content
- The_content and Preg_replace in loaded Iframe [closed]
- first paragraph of the_content as meta description
- Changing where my author box is printed
- Insert Content Before div#main from the functions.php File
- If is_single in functions.php
- Conditional function for excluding first image from content, not working
- Strip all HTML tags from product content and resave
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- $content is empty while using DOMDocument
- Shortcode to eliminate and replace with
- Function the_content
- How accomplish modification the_content if home/start page?
- Creating mixture of shortcodes to use in the visual/text editor
- How I can show short content with short tag
- paginate_links() don’t properly work in search.php?
- How to influence the information displayed on widget inside wp-admin
- Remove Container Element From wp_nav_menu() Markup
- WordPress function like is_category for subcategory? is_subcategory?
- Using a private method as an action callback from within a class
- Auto close (hide) custom metabox / set default state
- How to activate “Description” metabox for menu item programmatically?
- Adding WooCommerce to a Custom Theme – not working [closed]
- WooCommerce add_action hook results in 500 error
- Advice: Template structure – php blocks in sidebar or someting else?
- Changing itemprop from logo to image on custom logo?
- wp_get_post_terms() returns WP_Error in functions.php but in template it works
- Move jQuery and Migrate to footer?
- Make menu structure match page heirarchy on page parent change
- Change Rating range in Link Manager
- Function call via ajax – can’t figure it out?
- How to add nav menu items to a specific position within a menu
- woocommerce: change default setting > is_sold_individualy function
- WordPress Menuing Question :focus
- call of javascript function to external url always blocked by cors
- Can you put a condition on add_image_size() depending on the width of the uploaded image?
- What WordPress function to use to get meta value by using meta keys?
- Create a custom taxonomy that will be used to create and filter markers in a Google Map
- Adding an external HTML link to a post thumbnail
- Overwriting the menu break points of twentysixteen in child theme
- Is there a WP function to get taxonomy name from taxonomy_term_id?
- How to create an onclick event on an image in a post?
- Help With Creating Shortcode
- How can I use Woocommerce $product->get_attribute in functions.php? (if at all)
- How to set default post editor based on role?
- Hide thumbnail on search results when thumbnail not set – using Oxygen
- Solved: redirect to another page using functions.php
- Getting the teaser text without overriding global variables
- Problem enqueuing scripts on not single posts
- referencing the current user in a page i created in wordpress
- is_main_query() always returning false
- Undefined variable issue for wp_get_attachment_image_url
- Counting posts and trigger it [closed]
- ACF Flexible in TCPDF
- modifying every other element’s class inside while loop
- Adding Custom Body Class for Page: Shop
- “Conditional query tags do not work before the query is run. Before > then, they always return false. “
- Change ‘Categories’ to ‘Topics’
- Is it possible to use ‘wp_insert_post’ function within a for loop?
- save_post function keeps triggering: Warning: array_map(): Argument #2 should be an array… when restoring from trash
- Restoring pages in wordpress
- Redirect after login to current URL
- Restrict certain roles registrations by domain
- Replacing term/taxonomy archive pages with search queries
- Different body image backgrounds on different pages, posts and categories
- Language switcher for subdomains
- Function to draw random image from specified category destroys site logic – why?
- Issues with add_query_arg() not passing a variable
- Add Function For Instances of Custom Text in Multiple Category IDs to display in post content
- Move captions under gallery images in twenty fourteen theme
- Force changing the Site Title and add link
- create submenu page – error function not found or invalid function name
- How to add a class name to the ancestor of a post?
- Retrive post by tags PHP code
- Sorting date results from a query
- Using is_plugin_active within functions.php
- Button generate a random URL [closed]
- Add custom css to theme
- How do I add functionality to images?
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- Load script only on selected Pages
- Using input_attrs() Multiple Times Within One Customizer Control
- Convert Image to Webp on upload without plugin