UPDATE: Okay, Looking at the Error, it should be easy. Just remove any Whitespaces or Clear Lines at the end of your Plugin file after the last “?>”.
http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
Did you copy&paste the code here? Because it seems like you have some whitespaces that should not be there in the line
<?php if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query- >the_post(); ?>
If you remove the whitespaces (like this:
<?php if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post(); ?>
), it should work.
P.S.: Don’t forget to use
<?php wp_reset_postdata(); ?>
after the
<?php endwhile; ?>
Otherwise it could end up messing with the rest of your page ^^
Happy Coding,
Kuchenundkakao
Related Posts:
- Custom field outside the loop and inside an array
- Individual Widgets per Page
- Having different sidebar content for MANY pages?
- Get custom field values into the sidebar/widget?
- Order posts by custom field and if custom field is empty return remaining posts
- Best way to allow manageable social media URLS?
- Calling Specific Pages with wp query Part II
- Loop through two different sets of custom fields
- How do I exclude posts by custom field value?
- Echo values from custom field outside loop php
- How do you create dynamic customised sections in WordPress?
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Calling custom fields for pages (not posts)
- Duplicate posts being displayed when querying Custom Fields
- Creating a custom menu/widget area
- Loop to display random posts only if a custom field matches category
- How can I show custom fields in the loop only to specific user roles?
- get_posts that match a user-specified value on a page
- Creating a widget with a number of custom fields
- Accessing loop functions (e.g the_title or the_content) from post ID
- Limit the number of acf content when displaying in post loop [closed]
- How to display image inside container of custom made widget
- Want to make A CSS if meta key value is empty
- Is there a better way to list all database terms alphabetically?
- Change the main loop WordPress impact on the server?
- how to display a widget only on a page where the custom field is defined?
- custom-meta-box checkboxes from loop won’t save
- How to show a post if was published less than two hours ago?
- List users by sum of all their posts’ custom field values
- Custom Fields – How to create a list from multi-line entries of a single value
- how to make nsfw post with thumbanil
- Custom Query based on custom field of a single post
- Efficiently sort only certain categories by custom field
- Can I access a post meta field before the loop?
- Displaying page image in the footer automatically
- Show image if author meta (profile fields) exists outside loop
- Can’t query by meta_key
- What’s the best way to implement custom widgets on a per post basis?
- ul list with only as many li’s as filled custom fields
- Loop through incrementing custom fields
- Is there a way to dump all registered sidebar/widget?
- do_shortcode close
- Search Results Page – Displaying Custom Meta Fields
- Display custom widget value in header.php
- Add custom data (field) to sidebar widgets for later display
- Interrogate a page within a loop to check template type or custom meta data (Pages vs Posts)
- Collect Data from NEXT item while in loop
- How to show content of custom fields in search results?
- Display metabox title for custom fields with values
- use custom field value as post category in loop
- Filter or order based on custom field
- Compare ACF date field (if exists) and post date and order DESC
- What am I missing in this Code Block?
- get_field values for each post on home page using wp_add_inline_style
- User Filter Options on Archive Page
- Custom meta boxes – add php code inside?
- get wordpress post loop by meta box date
- Outputting custom field on home.php not outside of blog list
- Counting number of images from loop
- Metabox value for post loop?
- Get meta value when the page is a blog archive
- Add class from custom field into widget class
- Running a Gallery Shortcode in a Custom Fields Widget
- I want my post to republish again after adding a custom field
- Display posts where date field matches current month?
- Filtering posts by WORD in custom field
- I would like to display different text on different pages
- How to check if custom field exists in this widget query
- Retrieve IDs from custom field, count and display results differently according to count
- Pagination not displaying correct number of pages
- Display custom field outside the loop
- Custom field not showing
- Order by a meta field in query loop
- Add fields to edit in custom widget
- get_the_ID() retrieves same ID on Gutenberg’s Query Loop
- Advanced Custom Fields: how do I check to see if a value is set in an field? [closed]
- WP_Query – Order results by meta value
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- getting all values for a custom field key (cross-post)
- How to add a custom field in the advanced menu properties?
- Custom query with orderby meta_value of custom field
- How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?
- Using meta query (‘meta_query’) with a search query (‘s’)
- Can I exclude a post by meta key using pre_get_posts function?
- Add validation and error handling when saving custom fields?
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Show Custom Fields in Quick Edit
- Where are custom field values stored in the database
- Validating Custom Meta Box Values & Required Fields
- Max length of meta_value
- Add custom fields to wp native gallery settings
- How to fix missing custom fields after upgrading to WordPress 4.8.1?
- How to enable custom fields for pages (if not a bad practice)?
- How can I add extra attribute in the ‘Page Attribute’ section in wp-admin for pages?
- Is there a way to set default custom fields when creating a post?
- Custom post meta field effect on the performance on the post
- How to get custom post meta using REST API
- Custom field/meta populated by dropdown of existing posts?
- Difference between meta keys with _ and without _ [duplicate]
- Is there any action filter/hook for validating a custom field before publishing the post?