Try using the post
variable to access the post_title
global $post;
$s = $post->post_title;
echo substr($s, 0, strrpos($s, 'on') - 1);
Related Posts:
- How do I add a php statement to a jQuery string
- Concatenate site_url and string doesn’t work
- Count number of published posts by type
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- Remove query string specific key value
- Replace shortcode in substring
- Insert custom PHP head above in WP pages
- WordPress function and string as variable?
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Filter results from a serialized string to use on statistics
- PHP $_REQUEST array empty
- Custom functions for string data calculations
- problem in using wpdb->prepare and a string placeholder
- How to fix ‘Notice: Undefined index:’ in PHP form action
- Pass a PHP variable to another file
- Switching wp_get_sites to get_sites
- Modify image while uploading
- Using Global Variables Expensive for PHP
- One button to change all settings in theme customizer?
- Add custom image sizes to media uploader
- Export all post from database to JSON only when the database gets updated
- How php content after the first and second paragraph
- Multiple pages on one with different HTML
- How to resolve error “Cookies are blocked due to unexpected output.”?
- Is $hook a global variable in WordPress
- Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- Convert imploded plain text into links
- WordPress get pagination on wpdb get_results
- PHP if Condition not working
- How to return a foreach inside a shortcode
- Extend a class of a plugin
- Include a php file from functions.php only to homepage
- How to get the Page Number of the Current Page in Single Post Pagination
- Handling Body class based on Template
- Changing layout with wp_customise
- Mass update excerpt
- Show prices with tax in Woocommerce Mini Cart [closed]
- WordPress ajax doesn’t display object method on jQuery .change() function
- Get post id in a function when edit/add a post
- Reconfiguring WordPress site
- Use Icomoon external svg file with
- get_template_part based upon post’s category
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Hacked WordPress website /Homepage redirect [closed]
- Query if audio attachment AND/OR custom field
- Database query works fine outside WordPress
- WordPress page content outside WordPress
- How to solve Woocommerce Memory Limit
- Shortcode to find and replace URL
- How to add drag and drop functionalities to a div inside option panel
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Seo Friendly Filter URLs
- PHP contact form not redirecting [closed]
- Add value to new attribute inside WordPress menu items
- entire JS folder not loading in a WP theme
- Add new post in existing categories using wp_insert_post
- I’m unable to call img path using single quotes in an array?
- Else/If Statement to Display Photo Descriptions
- PHP error with a shortcode: “no suitable wrapper” for file_get_contents
- Correct code to use php in text widget
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- custom header text
- Display additional page templates and a sidebar on plugin activation
- Dynamic menu with custom post types
- Too many errors on log
- I am trying to edit the homepage of the Shopper. Since published I can not make changes and wanted to see if i can disable in (tpl-page-homepage.php)
- I need to display posts in subcategory beside posts in main category
- Trying to copy linux blog locally with XAMPP – php fatal error
- unsetting actions (edit and trash) of specific posts from that list of all pages or posts based on each posts metabox value
- Add a Metabox checkbox to the Page Edit screen of wp-admin , which only certain roles can see and Makes only certain roles able to Edit said page
- Display Results of SQL Query on WP site
- How to search order using database frontend short code WordPress
- Internal Server Errors – Moving working multi-site install to my localhost
- How to display MySQL table data which is stored as an array?
- Categories does not show Block editor WordPress
- Foreach Loop Of Post Types With Nested If Else If Not Completing Process
- WordPress Slick Slider + Magnific Popup
- Fix common misspellings/errors based on array of replacements
- Search for single post by 2 tags
- Import Instagram post as WordPress post
- Redirect user role to a specific page on login in a multisite network?
- spl_autoload_register is slow for WordPress sites
- Contactform7: display results from CURL
- How to update option field in database on clicking the publish button in customizer
- Get current_post in reverse order with pagination
- Add ID to output only for first option
- A javascript function that simply runs a php function on the plugin
- get_post_thumbnail_id returns a negative number
- Escaping html for meta description
- How to make 2 similar functions more efficient
- how use php query in AJAX jquery
- Insert wordpress tags below posts via functions.php
- how to manipulate HTML parameters using PHP conditions
- Add multiple JavaScript files to template header [duplicate]
- How can I add page template after post of a post type?
- How to insert a variable into a query parameter?
- How to edit homepage in WordPress?
- Adding Custom JQuery Menu Fresh Slide Out
- how to create twitter card without plugin in wordpress website?
- How to use phpspreadsheet reader with $wpdb