Post ID is not an argument in the_title()
(see Codex article). Accepted arguments are:
the_title( $before, $after, $echo );
Take a look at the source code. The function the_title()
calls get_the_title()
with no arguments, whereas get_the_title()
takes a Post ID as its only argument. If you want the title of a post/page other than the current one in the query, stick with echo get_the_title(...
.
Edit: BTW, Post ID is an argument for neither the_content()
nor get_the_content()
.
Related Posts:
- How to Get All Posts with any post status?
- How can i get count from query post
- query_post by title?
- How to set posts per page using WP_Query()
- Ensuring sticky posts are retrieved first (without using two queries)?
- query_posts() in function makes global $wp_query out of sync?
- Problem with ‘post__not_in’
- Sort posts alphabetically by custom field value, insert divider between different letters
- Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?
- Custom Post Type “Event”: chronological list of recurring events
- Schedule Sticky Posts
- Total Count of Posts NOT in Selected Categories?
- Single page theme
- Pass the same object to multiple widgets in a template with one query
- Help with CPT template pagination
- Order posts using a custom array
- Tricky WP Query
- WordPress pagination showing same posts on each page
- Search breaks when querying main loop for category
- Using ajax with paging and a custom sub-query
- add_filter(‘query_vars’) not working in custom template
- Custom loops, sticky posts, and pagination nightmare
- Is there a better way to pull in custom content without querying posts?
- Why this code causes infinite loop?
- How to generate feed for custom template
- Organize template parts and page templates in folders in regards of template hierarchy
- Having an issue doing a WP_Query with post_content and category__and
- Custom query looking at multiple custom fields and properly sorting
- Pre-existing arguments when using queries
- How to setup blog page to render blog posts minus afew categories
- Pagination doesn’t work in query post in tag template
- Fetching $_POST from Page Template into functions.php
- Passing query variables to a custom page template
- Having trouble using this post category query on multiple pages?
- How to refine WP-Query with further criteria
- Run second query on page based on author of the first query
- Query Posts (post meta)
- Adding css tweak based on page template
- WordPress pagination returns the same posts
- Some doubts about how the main query and the custom query works in this custom theme?
- Page editor missing Templates drop down
- Display/query post formats
- WordPress Custom Query
- Using Query Posts With Multiple Post Types And A Taxonomy
- Help altering a query to exclude all but standard post format
- Best practice for multiple queries on page
- How to limit search to first letter of title?
- How to find out what “Blog pages show at most” is set to [duplicate]
- How to ensure that is_search() return false after query_posts
- How to apply a custom template for posts by default?
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- Create second custom 404 page for selected post type
- Easiest way to show total number of subpages
- Query 1 taxonomy term, exclude another
- Pagination on custom query
- Querying posts with meta value that begins with a certain pattern
- Order a query result by a numeric meta key even if it does not exist, but put the posts with meta key first
- Custom Template 404 for specific custom post type
- Create Template for Custom Post Type same like for Page
- Multiple loops without repeating content
- Is there a way to set different post templates for parent posts and child posts in the same post type?
- Possible to display posts containing a short code ?
- How to run a SQL Query for character in Post Titles
- Authors List page : how to exclude posts from certain category
- Display custom tags on pages that have a specific page parent
- How to create a template for Pages?
- How to query for all posts that have a particular meta key?
- WordPress query_posts by tag doesn’t work anymore(?)
- How can I override one post and make it display content for another post?
- Can’t get pagination to work for sticky posts only
- show x number of posts from y category on homepage
- How to create query to get top 3 sticky/latest posts
- How to Show Comment Count on Related Posts?
- On what hook can I get the queried object’s final state?
- Pagination for custom loop on custom page template is not displaying anything
- How to use ‘WP_Query’ or ‘query_posts’ to display content in a descending order
- Make query_post category name dynamic
- How do I show content from a plugin using the template the site is currently working with?
- How can I list posts with different formats depending on order?
- query_posts orderby postmeta [closed]
- Load php file with jquery in single.php
- View Achive with Category Filter, but Page per post not working
- How to stack name list in non-alphabetical order?
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- Query post and sort by custom value calculated with custom field on cpt
- WP query_posts group by meta field related
- Random home page at each refresh between array of page IDs
- custom post type and a “sticky” position taxonomy
- Ordering of posts, 2020 Year showing as next event when should be last
- Problem with my loops
- wp_query args with relation
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- Modify query to exclude certain ids and certain parents and its corresponding children
- How to display most popular post by views count in WordPress?
- wp_query select if have comments
- Using custom post types within a section of a template
- Listing all custom post types using a specific term on the said term’s template page, in groups
- using a template for more then 1 page
- Incorrect posts displayed on category page
- What is the point of using the front-page.php template? [closed]