You get the error because you try to call php inside php. Try to use this snippet and see what is different:
<?php
if(get_field('post_image'))
{
echo '<img src="'. get_field('post_image') .'" />';
}
else {
echo '<img src="' . get_bloginfo('template_url') . '/images/images/default.jpg" />';
}
?>
Also pay attention that bloginfo
immediately prints value, when get_bloginfo
returns it.
Related Posts:
- How do I change/modify the_post_thumbnail(); html output?
- Add custom HTML to posts page
- Converting HTML Template to WordPress Theme
- Customize position of social icons in upme plugin [closed]
- How to get the value of input hidden html from text editor to custom page template?
- How do I add a custom css to all posts without affecting homepage css? [closed]
- Add data-id attribute to child page links
- Clickable image link sends people to wrong URL
- Displaying images outside the content
- Hide A Class and Add Custom HTML Code Using WordPress
- Configure WordPress to Use Responsive Image Rendering
- How to use data URL in WordPress?
- How to include different html tags in the header for different pages?
- Multisite – Display different header content based on which site is accessed
- How do I routinely extract the thumbnail of the most recent post?
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Gallery requires a featured image but does not show it in posts/pages
- Save Option on Database
- How to remove the intro animation which appears during the load up of some WordPress themes? [closed]
- Add multiple HTML attributes to an Elementor button
- Why have on every line
- WordPress and event-driven programming – what is it about?
- Adding a custom image upload size and making it selected by default?
- Create Image Uploader for Widget
- WordPress Ajax always returns a 404 error
- Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress
- How to resize image on client-side before upload?
- Limit the Excerpt field in WP-Admin in words
- How to get custom image size for image uploaded in Customizer
- WordPress Wysiwyg Content not being displayed
- How do I add HTML to a PHP function [closed]
- Random Default Avatar Function
- WordPress automatically adding html tag around PHP code
- Missing sidebar parameter “fix” – before_content
- How to get the POST TITLE using the POST ID?
- Customizer: Output default value in Customizer CSS
- Taxonomy linked to pages
- Load a page into a div with Ajax
- Best practice for migration friendly images in posts/pages?
- Can I install/embed WordPress on a ‘single page’?
- Unread Repeater field IMG alt not working
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Custom posts in different columns style
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Display Youtube Time Automate from Key
- HTML table attributes ignored
- How to fix this PHP warning in WP-Admin after upgrading to 3.1.2?
- Where is the PHP code generating an element?
- Prevent redirect to wp-login.php
- Basic wpdb update question
- trying to get wp_get_attachment_url to output clickable link
- WordPress widget and customize.php not working in Ubuntu16.04 VPS
- Get featured image with custom size outside WordPress
- How to use the checked() function to check for a non-empty var
- Calling function in loop causes repeat data
- Images Uploaded saving onto older/previous year folders
- Find out last 7 days of upload images, last week uploaded image from Gallery and display them in different pages
- How do i wrap woocomerce attribute in list?
- Is there a hack for using is_page() within the function.php file?
- save metabox with new values _wp_page_template
- How to Make Thumbnail of Post Stay Animated
- pagination broken – clicking next displays “page not found”
- CSS images don’t show up with bloginfo
- Custom forms with HTML
- Wrap title and excerpt in a div (latest posts block)
- Create condition for Author bio Social Links
- how to changes mobile menu toggle breakpoint in WordPress
- PHP inside echo HTML
- Change extension to .jpg when webp is not supported
- Prepend to all image URLs with PHP, only for mobile devices
- Woocommerce template file outputting tags
- Trying to update Woocommerce meta values
- What are the advantages/disadvantages of ways to use php template files?
- If Statement is Ignored?
- Remove span tags from WooCommerce Downloads page
- How to enable HTML tags in category description without breaking the category page
- Can’t display anything through homepage text editor
- Create “blank” admin page without having admin-bar/admin-menu for faster load
- Create Schema in WordPress with PHP
- Woocommerce custom attributes list help
- WooCommerce multiple custom fields code
- Access certain Entry in HTML-Table and pass the entry-data in WP not working [closed]
- How to always display full size image
- Pass form attributes to another php template in wordpress
- How to associate dynamic PHP page for chosen WordPress tag?
- Code works on page-example.php by not category-example.php
- Only display notification on single post
- Add options to WordPress backend
- Automatically create a loop for post ID
- Widget header unique classes
- why is this content-template not showing any of my blog-entries?
- How to get the count for each taxonomy term
- images in wordpress themes
- How to use custom fields to replace top-level parent title with an image using wp_list_pages?
- How do I return an image from a script
- Select area and checkbox data is not saving?
- In reading settings posts are set to “blog” and I have page-blog.php but no posts
- Parse error: syntax error, unexpected ‘}’ in
- Understanding responsive imagery
- How to create different templates for woocommerce single-product.php?