you can’t run code inside quote since php treats it as string, try this:
<?php
$newsposts = new WP_Query('cat=restaurant');
if ( is_front_page()) {
echo '<h3 class="member-review">Latest Restaurants</h3>
<div id="extra">';
if ($newsposts->have_posts()) : while ($newsposts->have_posts()) : $newsposts->the_post();
echo '<div class="reslogo"><img src="'.catch_that_image().'"/></div>';
endwhile, endif;
echo '</div>';
}
?>
Related Posts:
- What is the meaning of %s, %1$s etc.? [closed]
- Include WP_Query in my own PHP file?
- Has anyone tried putting PHP ActiveRecord on WordPress?
- Copyright info change in Theme Child PHP
- Add footer.php to WordPress child theme
- I want to remove the links from the term list returned by get_the_term_list
- 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?
- How to display posts of specific category using a custom Query in WordPress?
- 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
- 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?
- Latest post in a specific menu
- Cause of Blank Lines Being Added to WP FIles?
- How to save checkbox values for logged in users?
- Insert custom PHP head above in WP pages
- Log in / Log Out Custom Button
- How to do a code in php and have text before it? [closed]
- Display Data in Table from External Database in WP using Shortcodes
- How to Configure Events List in WordPress to Disappear Event Once Date is Past
- Code snippet to show current php version inside “At a Glance” box in admin
- Fatal error: Uncaught Error: Call to undefined function get_header() [closed]
- using wp enqueue style to create a CSS file specifically for a page template
- Accidentally deleted php code in WordPress website [closed]
- random reason on refresh
- Insert PHP code in Text
- PHP code snippet to remove microdata
- Counting number of posts in multiple (sub)categories using shortcode
- Need help for some PHP code
- Woocommerce display orders with products from specific categories to specific admins
- Woocommerce template file outputting tags
- Copying and pasting to WordPress “code editor” code via the front end and clipboard
- How to preload header logo image in WordPress? like what’s the code and where do I put it?
- How to put 2 php codes in functions.php without site crashing
- Displaying SQL query result from user input via wpdb
- admin-ajax.php 400 bad request – whats wrong with my code?
- style.min.css code issue
- how to run a php code in widget?
- how to add number value in front for variable [closed]
- Blog only showing code
- Display pages from specific page template
- why is markup routinely placed in functions in wordpress?
- Themes with variable width or single columns? I want to display source code
- Open all external links in new window – need help with the code
- How to get the Woocoomerce subtotal value without tax in the hardcode? [closed]
- Where to put include php file?
- Can you not edit the HTML and PHP of your WordPress without paying?
- Dynamically added text at bottom of article – non searchable by PHP code
- how to create twitter card without plugin in wordpress website?
- Upgrading PHP version results in “Use of undefined constant WP_CONTENT_DIR” warning?
- Can’t Find a Way to Edit the Home Page Content [closed]
- Fatal error: Call to undefined function wpsc_cart_item_count()
- No wp-config.php file on local install of wordpress – site still displays
- Woocommerce Custom CSV export
- Add a Different CSS Class Into The Body Tag of Different WP Pages
- How to limit the content coming from wordpress shortcodes?
- Change description on specific WooCommerce product status change
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- How to deal with checkboxes in edit page?
- Must I download entire WP directory for each separate instance/website that uses WP?
- search and replace preword from author
- Add meta noindex to post if it has a specific taxonomy
- Displaying Hierarchical custom taxonomy
- Open post-content in archive page in a Modal box with bootstrap
- Creating own shortcode – echoeing php variable based on JS variable
- Sort meta-value in the sequence array in pre_get_post
- How do I link a button I created in theme customizer to a function?
- how to remove colon and white space in a string by php
- Shortcode not staying inside div tag
- HTML showing after PHP code in tag
- Adding Author Box Meta Links with Co-Authors
- Lost in trying to create user database system
- Remove   from the_excerpt
- Can’t pass the variable from a select to PHP query
- “if parent category is” conditional?
- Deactivate a plugin on wp version
- the_post_thumbnail issues
- linked php file not executing php
- Add other class content with reference class value
- I want to show cart items number if any or nothing, simple CART text
- Slug duplicates once clicking on link
- Find and print first entry from WordPress post in custom excerpt?
- Language does not switch while cache is enabled
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- Limit content size by character or word in database
- Set user status to absent on WordPress
- Customizer: How to Sanitize a Decimal Number Range
- Switch position of elements in the footer [closed]
- Problem with ajax request and directory structure after site migration
- Access methods in plugin template
- WordPress HTML Helper
- Adding unique marketing messages between certain products whilst using isotope/Infinite Scroll
- Notice: Undefined index: fix with isset [closed]
- Amending PHP for WordPress Theme
- get_permalink returning first letter
- How to modify default tags in wp_head()