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?
- Simple WordPress endpoint route doesn’t work
- Correct PHP to output a single result of a Function with SQL Query
- How to relocate paypal button gateway on checkout page in woocommerce
- How to create a field in customize and show that in header.php?
- WordPress shortcode returns the data before
- Passing the name of selected color from the custom component to `render_callback`
- I am receiving a pluggable.php warning sign on my only http:// page
- How to remove the h6 tag for the entry-category Class
- your php installation be missing the MySQL extension WordPress CPANEL [closed]
- Can’t add script immediately after the opening tag on login page?
- Find Site ID From WP_Post
- Is it possible to create new user from external form using REST API?
- WP_Query: getting posts where custom field exists
- Foreach loop inside an array_merge
- page-slug.php not working but only for specific slug
- {$key} or $key?
- How to show meta value code HTML after x paragraph
- Redirect to a page for only logged in user
- Send a mail to specific address in a custom field when a new comment is made on a specific post
- Display the 3 latest WordPress Posts on a Static Page Outside WordPress
- Export Form Data to a CSV then send it as an attachment – contact form 7
- Override user-edit.php to design own profile page
- Live to Local on MAMP, not working, outputting functions.php code
- Remove extract from function
- Undefined offset: 3 in custom function
- List all blogs, but exclude the main site
- How to append to an array and return the results in a filter?
- How to specify the path for require_once in a child theme?
- Set site title & tagline with wp.config or function.php
- How can I add a new row in a separate database when someone registers via WordPress?
- Shortcode to embed Edit Account form not working
- Redirecting to a custom forgot password page
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- Warning: printf(): Too few arguments in helpers.php file
- $_SESSION variable not saving on page refresh or new page
- Form search query – displaying ACF “Post Object” field as results
- Errors after upgrading PHP to 7.4 WordPress
- Design with Elementor and code the rest?
- Add additional functions file instead of functions.php
- How to make jquery count down timer function manually editable
- Issue with fetching mysql data and displaying results via shortcode in webpage
- wp_insert_post() with HTML tags using PHP
- How to rename woocommerce-billing-fields
- Any ideas why I am getting “I’m getting “wp-admin/admin-ajax.php 401 (Unauthorized)”
- InnerBlocks with allowedBlocks not working with acf_register_block
- Can a plugin redirect product page based on IF condition?
- Cant register rest routs from class instance