the_title()
and the_content()
both include an echo.
You want to build a string, so use get_the_title and get_the_content instead.
Related Posts:
- Specific loop in Shortcode
- Hide Post comments when displayed via WP_Query
- Shortcode with ‘year’ parameter
- How to convert query sql to shortcode in wordpress?
- Function is printing twice – any suggestions?
- Is it possible to query a category with specified posts?
- Stop WordPress automatically adding tags to post content
- Get current post id in functions.php
- Random sort within an already sorted query
- WordPress removing tags?
- Search by Hyphen
- Exclude drafts in all() view of edit.php
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- Keep getting same permalink with WP_Query?
- How to query posts with current or future date only
- WordPress Number of Posts Not Changing With posts_per_page
- Pagination not working on Custom Page Template
- Create new WordPress post [wp_insert_post] based on results of a WP_Query
- Exclude posts with specific meta_value while sorting by a separate meta_value
- How to add shortcode tags in single.php [closed]
- Display the latest posts, published in the last hour, with WP_Query
- Custom Order in WP Query
- Fetch posts from current week (Sunday to Saturday)
- Search query – exact post title match
- Converting multiple loops into one single loop with pagination
- How would I get 1 latest post from a query for 5 posts?
- How to get most recent commented post above new submitted post in WordPress?
- How to start with post number x?
- Exclude posts with empty post_content in wp_query
- Exclude posts from featuring
- Lazy Load using WP_Query pagination
- Only display a certain number of posts, dependent on how many posts there are available in a query
- AJAX filter posts by year
- Automatic post deletion
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Duplicating Table of Contents for Paginated Post
- Query how many items to show in shortcode
- Yearly archive page for future year
- How can I show many posts an author has per week?
- Ajax load more button in Recent posts widget
- WP_Query orderby not working with meta_value_num and menu_order
- Custom WP_Query with complex ‘post_status’ argument
- is there a way to show the the post title after the image?
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- Blog post per page setting conflicting with custom WP_Query?
- How to exclude latest x posts from a paginated query?
- Pausing and Resuming WP_Query results
- Select only post id and meta value with WP_Query
- How to : pagination in 3 different custom loops on the same page
- how can i change WP main archives loop to sort by name or title
- How do I extract just the post ID of the first item in whatever WP_Query returns?
- Show post content and title in diferent divs using WP_Query using a loop
- How to get a post’s details by shortcode?
- why the same code got different results when using query_posts in functions.php and index.php
- How to get posts published on the latest date?
- Page and post loop same template
- Show metabox value last post excerpt, title and link
- WP_Query: Show 10 posts in date order, first three random
- Related Posts function not working
- Why aren’t paragraphs breaking on this page?
- wp_query if have posts show date but not in loop
- Custom WP_Query not working correctly
- Echo the number of posts being displayed
- HTML Inside of Shortcode Breaks Shortcode Output
- WP_Query of Category Not Showing First Post
- Creating a related posts section in wordpress inside a default post
- WordPress Query – Display 5 posts (same post type), each from a given tag
- While loop in functions.php outputting the_title() of each post on frontpage
- What parameters do I need to pass to get_tags to get ALL tags for the site, when used in a post
- Show posts from two specific category in WP_Query
- Why sorting posts doesn’t work properly?
- How can I create a shortcode to show the number of posts of actual day?
- How to create loop of posts except post ID defined via ACF field
- the wp_post_update isn’t working all the time
- How to pull sticky post permalink inside php?
- Display specific posts based on an ID of another post
- a WordPress connected to 2 database
- Change URL of previous posts and next posts link in WordPress
- How to invoke a HTML custom button based on a HTML dropdownlist menu
- long-title posts do not want published
- Mix post date with post meta value using WP_Query
- WP_Query that targets all categories
- Fill the exclude array() in get_posts()
- The first post appears twice
- Double loop output
- WP_Query sort by meta_value_num or date
- Custom layout manager for posts
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Can’t get pagination to work
- Change the default video URL in a post to shortcode format
- How to get single post by one author?
- Order by ‘s’ using WP_Query()
- how to print loops for odd in 1st column and even in 2nd column in wordpress [closed]
- If post has non-shortcode string
- List posts related to category on a div [closed]
- Wp_query WooCommerce products
- posts_per_page – Repeats only first posts ‘post__in’ array
- query_posts different amount of posts per page [duplicate]
- How do I get content of custom post type through post ID
- Filters do not work when there are multiple (one works)