Your issue with output is because you are using versions of template tags that immediately output the result when called, rather than return it to be concatenated with the string.
For example the_permalink()
as opposed to get_permalink()
.
Related Posts:
- Split Content and Gallery
- How to return loop contents
- How do I get the attributes of a short code from a post?
- Return vs Echo Shortcode
- as a shortcode within the loop?
- Adding shortcode closing tag after a loop
- What are the disadvantages of using global variable?
- Displaying terms based on loop posts?
- Missing image in gallery shortcode in custom feed
- Shortcode with a foreach and arguments
- Output loop leveraged shortcode twice on one page
- Custom Loop Using Shortcode in Custom Page Template
- Shortcode in posts called by ajax is not working
- Trying to get property of non-object in shortocde
- WordPress shortcode in content, output in sidebar?
- Query posts only with actual text content (not including shortcode or images)
- How can I pass additional params to a shortcode while in a loop?
- Get a Post Loop based on Logged in User information into a Shortcode
- How to add pagination in Terms
- Split Content and Gallery
- Shortcode for pulling specific Post Title outside loop when ID is passed in
- Have multiple loops on a page appear after/between page content
- Using shortcode within shortcode with dynamic variable
- How wp maps urls into files
- Show scheduled posts in archive page
- post__in – Placing content from a foreach loop inside of an array
- loop query exclude meta_key with meta_value
- “Blog pages show at most” in The Loop
- wp_insert_posts Fatal error: Maximum function nesting level of ‘100’ reached, aborting!
- Post Loop not Returning Permalink
- Custom page template
- Get posts that matches specific terms of multiple custom taxonomies
- add_filter() doesn’t work in loop
- Can certain (site-crashing) limitations on WP_Query in shortcode be overcome?
- The Loop in Static Page
- Content/Excerpt length control for a specific loop?
- Why we use if with while loop?
- Loop posts only excluding first post
- Loop repeating design pattern
- Customize WooCommerce Product Images (Placement and size) [closed]
- Create a loop that gets pages with their template
- Why is my loop not dynamically grabbing the correct Category and displaying all categorized posts?
- get latest 5 posts and a specific post and sort in a specific order
- How to check if a post exist?
- Query posts if meta key starts with
- 3 Posts in Loop, Show Stickies First
- Loop within a loop (Again) for template
- Why cant you place the Loop outside of the index.php?
- sticky post in custom loop
- Rating system and changing the loop
- Ajax Button to load more Posts into a timeline
- On single.php, fetch 2 posts created after and 2 posts created before in relation to the actual post (using menu_order)
- Problem getting current post tags to show in a widget
- Post classes in the loop are being changed in certain themes
- Exclude page name from loop
- PHP if post is already displayed, then
- How to style first post differently with ‘get_template_part’?
- in Foreach Loop the Description is not showing?
- 404 Template customization | Want 10 recent Post on the 404.php error page apart from the error Notice
- How to append a query string to pagination?
- For each loop on every word in post
- Display name of taxonomy once
- Use have_comments() for current post instead of last post in loop
- Displaying the first, second, and third posts from a category in separate slides
- Sending mail not working correctly
- Using variable in WordPress loop as criteria
- WordPress Alphabetical Sort Loop Issue
- Get_template_part() problem with the_content()
- Why doesn’t ‘continue’ work in page?
- Fetching posts from wordpress function in ajax
- Saving return value from the_author_posts_link()
- Print the whole page?
- Loop info in jquery Tabs – loop into a variable?
- Shortcode for Comments and Comment Boxes in Post Loop
- Adding $args to wp_schedule_event() causes hook to add infinitely to WP Cron
- $post is undefined in wordpress loop [ajax]
- Insert content above an embedded video inside Wordress’ php the_content
- Use ACF Category Image for all Taxonomy Archive Views
- Loop with custom posts, to include information from different custom post type
- the loop printing post in one grid
- Check value of post meta within IF statement
- Work arounds for conditional checks inside the loop in search.php?
- Get Sticky User in user loop based on user role
- Popular posts with Varnish ESI
- Querying posts from only one category and exluding the latest post
- How do I aproach this?(for sale, for lease, sold->move something from a category to another)
- How to fix pagination for custom loops?
- query_posts ignores the argument
- Need some help with “the_widget()” function
- show posts from one category with comments only
- Exclude Authors based off date of last post
- Loop from another WP site onto mine
- Having issue with WordPress loop
- I need to update the post query? [closed]
- Wrap every 2 divs in row – for each loop [closed]
- How to add class to the last image of the last post in a loop
- Multiple loop with pagination in same page
- How to get files from loop for zip
- Divide loop into several columns based on post custom field and enable infinite scrolling
- Query Loop Block: possible to restrict just child pages?