Use the_title()
:
function add_post_content($content) {
if(!is_feed() && !is_home()) {
$content = the_title( '<p>', '</p>', FALSE ) . $content;
}
return $content;
}
add_filter('the_content', 'add_post_content');
The first two arguments are for $vefore
and $after
. If a post doesn’t have a title, you get not extra markup. The last argument makes the function returning the string. Otherwise it would print it out immediately.
Related Posts:
- Issues with title-tag and document_title_parts
- How to customize search result page title?
- Breadcrumb how i can display page title with parent > child title with permalink ? any Idea
- Short_title character problem
- Remove H1 / title / Underscore – without CSS
- Is possible add icon in title posts only in specific tag?
- Function extending with if query in functions.php
- Best way to handle lack of titles in microblogging
- add_theme_support( ‘title_tag’ ) is not showing title on index.php
- Change Page Title
- Remove text after a dot and a colon in Woocommerce product title
- Parent category as WOOCommerce Categories widget title
- Display page number on custom page title function
- How to disable site title and description when custom header is uploaded on the customizer?
- Changing the color of post title [closed]
- Force changing the Site Title and add link
- Rename file after title , one small problem
- How to add a data attribute to a WordPress menu item
- Order posts (across the whole site) by metadata date
- Disable visual editor on one specific page
- How to display random users with avatars
- Can the wp-plugins (Must Use Plugins) URL be targeted for use in functions.php?
- In a WordPress plugin, how do you output HTML code inside the DOM header? [closed]
- Different ‘WP_CONTENT_URL’ for different subsites in Multisite setup?
- Linking thumbnail to full size image
- Removing Unnecessary Text from Admin Menu without CSS
- Display WordPress Search
- Preferred Use of home_url()?
- Functions.php reverted to new one
- Where does function_exists() look to decide whether a function exists? [closed]
- Get page slug and assign a variable within functions.php
- Clean-up script tags
- Make “sidebar template” the default template for new pages
- Refactor create_function
- WordPress function for 1 to for many
- Logic to Print/echo a css class only for 1st post and ignore all post after 1st? [closed]
- Attach parent category template to all subcategories
- How to insert a text in all pages and posts before or after specific places?
- Add class or ID to any WordPress function
- How to filter out shortcode when displaying the_excerpt() in the loop?
- Remove Font-Awesome MaxCDN Link & Load Locally
- How to remove howdy dropdown menu content
- Change Admin Bar “Visit Site” URL
- exclude a category from a search on a specific page
- Stop turning small dashes into longer ones
- How to get specified parent page title in my function
- Execute function after a post has been published
- Last updated date function
- Possible to display shortcode based on the category?
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- How to set default archive image without overriding first attached image? [closed]
- Toggle User Roles with button
- Passing a variable via wp_head and then calling it on the page
- Load Woocommerce and WordPress Functions Outside
- How to make custom column Admin>Users sortable?
- How to know which ajax file or function is called for action
- How to filter $content in shortcode function
- watermarking gallery items
- Difficulty with PHP function that displays a post’s format in WordPress
- WordPress Shortcode function display outside of widget
- Get rid of the widget Item Class=”widget-item”
- Storing password (functions.php)
- Change menu based on page template via functions.php
- wp_enqueue_script | Help me figure out what is causing jQuery is not defined
- Why is it so hard to add a class to the tag in the sidebar widget?
- Parent theme styles overriding child theme CSS [closed]
- Adding theme option values as custom body class
- How to add a new image size and apply it to posts only?
- What is the correct way to include my new functions and scripts in WordPress?
- Function to replace comment’s accented characters before posting
- Perform function on publish AND save (not just save)
- add_menu_page() with variable function
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- How to Override Page Template if URL matches query?
- Woocommerce Display Discount On cart
- How to offset main query without affecting other queries and backend
- ACF Date Form in Custom Admin Field
- How to make the first letter of a post title uppercase, in a plugin?
- Function to disable “href” anchor tags that contain “a data-name” on mobile only
- Execute jQuery with custom event listener after successfully add an item to the cart
- WordPress hooks to call a function inside a construct
- WordPress undefined function error on using add_action() in functions.php
- How to create admin ajax function for my contact form
- how to display featured image for single post for a specific category
- Database Query not working
- Load a Child Theme’s style.css just before the closing tag
- Can’t wrap my head around this function – any help would be appreciated
- Figure inlined width trigger distorted layout
- save_post hook – headers already sent?
- Exclude javascript in certain page url and all following url’s after forward slash
- How to use WP_rewrite?
- Wp get archive only text not link
- can not call functions in function.php
- Custom shortcode not being included in content paragraph [duplicate]
- Display post_meta-by_key on product catalogue
- What are the parameters are used in add_action and filters?
- Which template file to edit to edit homepage in Mystile [closed]
- Does functions.php apply to every page?
- function to show youtube videos within excerpt – if condition and apply_filters
- How to automatically load Google Fonts on pages only as they’re used?