You’re trying to use PHP tags while inside a string:
'<img src="https://wordpress.stackexchange.com/questions/302344/<?php bloginfo("template_directory'); ?>/images/social/facebook-share.png" />'
You need to instead use concatenation:
'<img src="' . esc_url( get_bloginfo('template_directory') ) . '/images/social/facebook-share.png" />'
Or my personal favorite, sprintf()
:
sprintf(
'<img src="https://wordpress.stackexchange.com/questions/302344/%1$s/images/social/facebook-share.png" />',
esc_url( get_bloginfo('template_directory') )
);
Related Posts:
- Echo URL of large version of Featured Image
- Recent posts with featured image or fallback image with permalink
- Reprinting tags with all attributes
- Scrape external webpage for first image and add it to new post
- Redirect to another page using contact form 7? [closed]
- Only show first image in foreach loop
- Get the id of all images in a post
- Prepend to all image URLs with PHP, only for mobile devices
- Retrieve first image url from custom post with pagination
- bloginfo url in javascript
- Is it safe to use $_SERVER[‘REQUEST_URI’]?
- How do I hook into WordPress to save an uploaded photo as an alternate size to an existing photo?
- How to check if image is already stored in a site’s post database? (network)
- Adding a custom image upload size and making it selected by default?
- The correct method to pass query vars in AJAX using ajaxurl
- How to draw media details for Isotope gallery using Photoswipe
- How to check if feed URL was requested?
- Create Image Uploader for Widget
- How to resize image on client-side before upload?
- Need to get specific data from array
- How to get custom image size for image uploaded in Customizer
- How to convert objects into arrays
- Remove query string specific key value
- Admin Options page. Save as Array
- PHP code to call image Caption, Alternative Text, and Decription?
- how can i show only the parents in owl-carousel?
- Change the URL of an image from wp_get_attachment_image_src except in the frontpage
- Best practice for migration friendly images in posts/pages?
- Responsive Header for Phone
- Unread Repeater field IMG alt not working
- foreach loop still echoes array
- My php header() function is not working [closed]
- Create custom permalinks to show Custom Post Type’s relationship?
- meaning of (array)function()
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- WordPress comment submit button substitutes/options
- Get html data with javascript to php array and store to wordpress database
- How do I create a numbered list with PHP? [closed]
- How to use array in function to get only value I want
- Warning: in_array() null given in PHP function
- How to access or parse key/values that have “string”
- trying to get wp_get_attachment_url to output clickable link
- Conditional multidimensional arrays and array_map
- Change default gallery images – Currently they are displaying full size imagese
- Creating black and white copy of an image [closed]
- Fetching Initials of the Commentator in the WordPress Website
- change default RSS feed URL
- How do i add slugs to a URL, but still redirecting to the same page
- how to make an array of post id’s in is_single
- How can I split my query result in 2 arrays?
- How to set a featured image (thumbnail) with PHP?
- Get css class of menu item in custom menu structure
- Nginx WordPress and another Web app URL structure
- Dynamically adding filters
- Order a WP_Query by meta value where the value is an array
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- how to get attached file url for current post?
- Creating customized php files in theme folder
- Comment_author_url doing nothing
- Using multiple variables to assign categories to an array
- Some problems in custom widget
- Displaying images outside the content
- Repeat a function with 24hrs gap for n number of days
- Checking page before applying image restrictions while uploading
- Workaround for og:image unsupported webp image type, Yoast SEO?
- Generate images with html2canvas and the woocommerce api
- Retrieve alt text by referencing the img src
- Order users by random not working?
- Show next image in array if page is revisited by same logged user
- Update Images after edit via php
- How to get the url of the entry in which an image belongs
- Get WordPress username to customize url
- WP post meta – for loop inside for loop
- Store custom field’s multiple values in one user meta key
- Need to Echo A Url path to show on a wordpress page
- How to include different html tags in the header for different pages?
- Trouble with checked() for array of multiple checkboxes
- How to use foreach and if statement within array of arrays?
- How do I routinely extract the thumbnail of the most recent post?
- WP_Post is not from correct array
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Save the outputted image into the Media Library, with a different filename and extension
- Adapting a php array to WordPress
- Creating image gallery in wordpress
- Image limit from 1 to 5
- Name Input from widget displays Sidebar name instead of saved data
- Passing multiple variables through url (php)
- Changing 2011 theme header image based on user dropdown
- What is this mark for “? function()” [closed]
- How to combine array info [closed]
- Remove /category/ from category (archive) page URLs (without using a plugin)
- WPMU – How to echo only one URL
- Force array to be a string [closed]
- How to automatically convert images to WebP on WordPress?
- get_body_params() is always empty in POST request
- Understanding responsive imagery
- How to extract URLs from wordpress taxonomies
- How to group by column a and sum column b and c in a php array
- PHP how to submit array elements to database
- Adding caption to all images inside an article