get_page_by_title returns an id not content. here is an example of what I use to get content from a certain page id.
call the function
$page_id = get_page_by_title('title');
$excerpt = get_excerpt_by_id($page_id);
in functions.php
function get_excerpt_by_id($post_id) {
global $wpdb;
$query = "SELECT post_content FROM $wpdb->posts WHERE ID = $post_id LIMIT 1";
$result = $wpdb->get_results($query, ARRAY_A);
return $result[0]['post_content'];
}
Related Posts:
- Define page template in wp_insert_post
- Add custom template page programmatically
- Define custom Page Template without its own .php file
- Filter the query ONLY for the search results page
- Custom page template how to check is_page from functions.php?
- Run Product Filter Javascript On Page Template
- Programmatically set page template based on page ID
- How to make unique add_filter to the_content of specific page template files – so each template gets its own addition
- Adjust which tempalte a page uses with a function?
- How to specify which Gutenberg blocks are available in the editor for a page template
- how to change link of some wordpress pages
- Filtering posts by category name based on page’s slug
- is_account_page() change to page slug
- How to enable template page only for a post id page
- Activate small php condition at footer over page template
- Get_template_part inside a folder
- Pass parameter to hooked function using custom page template
- different style sheet for just one page template
- Page Template Won’t Load Correct CSS File
- Function to check if custom page is used by page?
- How to Override Page Template if URL matches query?
- Probleme shortcode with list author
- How Can I Create a Friendly Slug for a Dynamic Page?
- Enqueue script if not page template
- Pagination won’t work on custom page
- Edit meta fields from within template
- Sending Messages Back to the Template After Processing?
- is_page_template wont allow me to enqueue scripts
- How to use different jquery function of idangero swiper dependant on page template?
- Logout redirect via page template without confirmation?
- Template Redirect Function Only Working When Logged In
- plugins_url vs plugin_dir_url
- Get list of years when posts have been published
- Redeclare a function in a child theme
- Is it possible to remove the “standard” post format?
- Do WordPress’ cron’s clean up expired transients?
- How to add first name & last name to default registration form?
- Masking logout URL
- How can I programmatically create “child” pages on theme activation?
- Warning/Notice about functions.php
- How to include one class/instance without using global variables
- Modify search function in WordPress (TwentyTwelve)
- Is checking whether the blog is installed necessary?
- Replace Archive Widget Link Text
- How do I deactivate a plugin for some roles
- How to display more audio file ID3 tags in WordPress
- Searching for content post
- Running CRON on Server with WP Function
- Using separate .php file for functions – how to run on site?
- How to include local menu based on page id?
- How to add custom fields to my custom registration form
- Add Featured image column into wordpress admin on pages AND posts
- How can I change the do_action function in footer (copyright area)
- How to display post content instead of excerpt
- Access Plugin data from Functions.php
- how to call a function only in specific pages and exclude it from other pages
- Which action does wp_update_user triggers?
- Use register_setting() in a loop
- Dynamic dropdown from database table
- Add dynamic links in WordPress custom theme
- WordPress website Rs changed to currency symbol
- Functions in custom theme
- Attempt to change jQuery version caused White Screen of Death
- check if author has published posts in custom post type, then send mail
- paginate_links() don’t properly work in search.php?
- Difference b/w Simple function call & do_action call
- What’s wrong with my use of plugin_url()?
- Hook into a function without a hook?
- Filter yoast canonical add_action priority [closed]
- Should I store functions in separate folder?
- How can I modify the element on all pages?
- AMP – Change rel=”canonical” from functions.php [closed]
- the_password_form functions not working together
- Function filter breaking tag archive menus
- How to echo the value of an array element using a function via a shortcode
- PHP 7.1 | Warning: A non-numeric value encountered in
- Way to redirect all Product Sub Category to its Main category Page?
- Convert multiple logos into the_custom_logo
- Fatal error: Call to undefined function is_even()
- search form leads to 404
- How to load a css file depending on the current role
- How to change images url in function.php?
- How to add HTML into error message
- Add a word after the post url if it is within a specific category
- Security when outputing wp_oembed_get code
- Stylesheet does not load despite functions.php
- How to show only specific category post by user role without plugin and restrict all other cats
- Unable to declare AOS library in functions
- Removing sanitize_title_with_dashes Function with The Real Title
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- Graphic before title – Specific Category
- Printing medium sized image
- What to do to have access to WordPress functions
- Adding a meta box fields to child theme options page
- How to programmatically GET (to know) which Sidebar (or) which Menu is being used on Different Pages?
- Remove theme, change theme button and WP version on “Right Now” admin dashboard?
- Making an under maintenance page (without using plugins)
- Image width issue in IE [closed]
- Get all users from role and add to dropdown (select) – wordpress, javascript
- WordPress enque the same script causes the setInterval not to work