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
- When should you use WP_Query vs query_posts() vs get_posts()?
- When to use WP_query(), query_posts() and pre_get_posts
- Create custom page templates with plugins?
- posts_per_page no limit
- Get post ids from WP_Query?
- Nested meta_query with multiple relation keys
- Custom templates not showing up in template dropdown
- How do I exclude a custom taxonomy from the post loop
- Some doubts about how the main query and the custom query works in this custom theme?
- Page template query with WP_Query
- Why query_posts() isn’t marked as deprecated?
- Alternative to query_posts for main loop? [duplicate]
- Wp get all the sub pages of the parent using wp query
- How to display page content in a page template?
- how to query posts by category and tag?
- Using WP_Query to Query Multiple Categories with Limited Posts Per Category?
- How to query for most viewed posts and show top 5
- How can I load a page template from a plugin?
- Order by meta value or date?
- How do I query by post format in WordPress 3.1
- Display posts of the last 7 days
- WP Query where title begins with a specific letter
- Is there a way to exclude the content from the post variable to save on RAM usage?
- Filtering posts by post meta data
- Is there a WordPress plugin that registers a plugin file as a custom page template?
- WP_Query vs get_posts
- Page editor missing Templates drop down
- Is it possible to stop selected plugins from loading on certain template pages?
- Querying posts from multiple sites in a network?
- Passing parameters to a custom page template using clean urls
- How to query_posts using meta_query to orderby meta_key AND have a secondary sort by date?
- Query posts by custom taxonomy ID
- How to prevent execution of default query, while preserving ability to use WP_Query in template?
- Display/query post formats
- How to edit contents of dynamic_sidebar()?
- How to move page templates to custom folder?
- Setting a custom sub-path for blog without using pages?
- Ways to have multiple front-page.php templates that can be swapped out?
- How to query post by user role?
- How to get IDs for objects in menu branch?
- Using WordPress to make a “Product Search” type navigation drilldown
- How to return results of a get_posts() in explicitly defined order
- WP_query parameters for date range
- Using OR conditions in meta_query for query_posts argument
- Custom post type archive 404’s with paginate_links
- Display all posts from specific categories on a page
- Query Posts in a Predefined Order
- Help to condense/optimize some working code
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- Is it possible to manipulate the list of page templates?
- Order posts by ID in the given order
- Add Content to Page without shortcodes
- Using a page template without a page
- query_posts exclude a meta key
- How do I create a random post that will last for a day
- Loading custom page template via plugin
- Query Multiple Post types each with own meta query
- Determine if more posts are available than was asked for in `query_posts()`?
- I put my blog on a subpage, how do I get page title?
- Create built-in pages without creating actual pages
- Get posts by menu ID