You are trying to use the_title() and the_excerpt() functions outside the wordpress loop, therefore, they will not work.
I suggest you try something like :
$args = array( 'posts_per_page' => 12, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);
$query = new WP_Query($args);
while($query->have_posts()){
$query->the_post();
// the_excerpt() will now work as expected
}
Related Posts:
- GET the excerpt by ID
- How to end the excerpt with a sentence rather than a word?
- Modify ‘Read more’ link adding a new class
- Remove image caption from post excerpt
- How to add an admin function only to posts, not pages?
- How to customize read more link
- Custom wp_trim_words() function not trimming right
- How to show post(excerpt) from specific category on wp page?
- How to link up “read more” on excerpts hack from WP Recipies
- Append Text to $post->post_excerpt
- Frontend Post Excerpt field mapping
- Allowing the SoundCloud player to appear in a post excerpt
- Auto Refresh Post List after X seconds
- How to show video from specific category on sidebar?
- How to show a full post, not just an excerpt
- Get post excerpt and title by specific post ID?
- Custom excerpt length filter doesn’t work
- Display most recent post in full, excerpts of older posts
- Modify WP_Post before processing
- Print a message if excerpt is empty after posts have been publish/update!
- get_the_excerpt() is not working as expected – returns wrong text
- How do I display some posts fully on the homepage, and some as an excerpt only?
- How to display excerpt post on hamepage and archive pages?
- Displaying post excerpt using wpdb query
- How to disable the_excerpt from one post
- The_excerpt() doesn’t parse – how to change that?
- Trying to edit archive.php to only show post extract, with featured image
- Show metabox value last post excerpt, title and link
- Hook for changing excerpt content when excerpt not set
- Change the number of excerpts displayed in search results layout
- the_excerpt is displaying excerpts of every post
- content summary of a post disappears If an images added at the beginning of the post. how to solve it?
- WordPress Excerpt Paragraph Limiting
- Grab value of excerpt_length
- Calling Permalinks With PHP
- How to Remove HTML Elements from Post Excerpt?
- How to add text before post_excerpt in Gutenberg
- Why is WordPress showing a blank excerpt for just one of my posts?
- Related post not showing table of content
- How to limit wordpress the_excerpt() dynamically
- Moved a website and excerpts don’t work for old posts
- Enable HTML Tags in WordPress Post excerpt
- How to display post excerpt beside post list inside Post of Dashboard
- Trim excerpt to first paragraph
- Nothing appears using get_the_excerpt() in category.php
- Post List Widget with custom posts and editing the Read More Link
- Show category post with excerpt text
- Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)
- How can i show only 30% of the “the_content(“More…”)”?
- Using the_excerpt() some posts are truncated and some are not
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- wp trim function not working
- excerpt in template for specific page
- Show full post only to loged-in users
- Read more opens attachment
- How to disable content pagination?
- How to add/assign or change featured image in post programmatically?
- WP-CLI Bulk delete posts from specific category
- Update all posts automatically when using post_meta
- Exclude ALL posts from sub categories
- Post ids are incrementing by an unknown number?
- Can’t show comments count per post outside loop
- Redirect based on user post count
- Should our pages be posts?
- Allow role to delete posts but block him the wp-admin
- How to Add ‘Post Categories’ to the Dashboard Sidebar
- Remove the Edit button in posts for permalinks on certain user roles? WP 3.3
- Show total author’s post views by posts post_meta
- Why is my Blog Page ID == First Post ID?
- Get the number of posts shown in the current page
- Get all attachment by post excluding featured and content inside
- Custom loop pagination links not working
- If in_category not working for multiple single.php pages
- display random posts on index.php instead of latest
- Automatically Import WordPress Blog to Facebook Page [closed]
- Only show a Post once in 10 visits
- add div after image in post [closed]
- How do I link a Post Type to a Template in Masterplan?
- Where is the “Posts”/”Blog” template?
- How to get posts ordered by using their categories?
- How to get value in radio input in post meta box?
- ACF date picker to trigger category change
- wordpress admin missing Posts button
- post and page and custom post type
- How can I use query_posts to loop through posts and construct my own content?
- How to make an image appear as a thumbnail in the blog post?
- If I moved the location of my generic “posts” page, do I need to change the slugs for all of the individual posts?
- Not display post meta if empty
- post_name is not stored until post is published… where should I store my slug until it goes live then?
- Adding div to WordPress page content
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Super post cleaner, could this be category specific?
- How to organise post by category and date
- Show post if in category
- Get current post’s child page?
- How to include Related Posts in WP RSS feed
- retrieve post slug by post_tags taxonomy
- Hide the contents for specific post
- Display post structure in function
- How to make the Post Author name fixed as “Editorial Staff” even if there are multiple authors?