I do this pretty regularly and have no issue with using functions in WordPress core. You can hook a bit earlier though and skip the 404 and header bits. In functions.php
:
function wpa88013_parse_query( $wp ){
if ( 'nlm-admin-thumbnail' == $wp->query_vars['pagename'] ) {
include( dirname( __FILE__ ) . '/thumbnail.php' );
exit;
}
}
add_action( 'parse_query', 'wpa88013_parse_query' );
And some example code in thumbnail.php
:
<?php
$content = "foo\n\nbar";
echo apply_filters( 'the_content', $content );
$post_id = 1;
echo get_the_post_thumbnail( $post_id );
I’ve just tested this in the twentytwelve theme and it works as expected.
Related Posts:
- how to get page id of a page using page slug
- Can we have a php “page” without a WordPress “page”?
- Put a link to a category round a hard coded A HREF
- Get ID of child from child slug, while knowing parent ID
- Get posts with at least one category in common with current post?
- Rename “Portfolio” slug?
- How to query for pages/post depending on slug?
- WordPress custom slug (endpoint) and compare all links
- Global variable $post returning incorrect object
- How do you use WP slugs for PDF files / media?
- WordPress plugin for nicer looking slugs? Have multiple pages named the same but they get different slugs
- What is an equivalent of single_cat_title for getting the slug of the category?
- What query string parameter is available for index.php, that works for both pages and blog articles?
- php script to change slug in post automatically
- List taxonomy term slugs within shortcode (do_shortcode)
- page-slug.php not working but only for specific slug
- Remove slugs from custom posts type
- Getting the slug into a variable, how to echo that variable
- Allow two posts (from different categories) to have the same slug
- Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters
- Get nice name of category from slug (remove dashes of category)
- Custom PHP form needs refresh to load page correctly
- Slug duplicates once clicking on link
- Rewrite rule not working, but only when parameter is text
- Hide a specific category title from displaying on site
- Exclude a category slug on pagination
- How can I output the slug of a comment author?
- WordPress using get_term to retreive slug not working as expected
- Weird slug in archives permalink
- php string inside shortcode does not work
- get_category only returning details for ‘uncategorized’
- How to disable page create for custom post type, but allow a page with the post types slug to be created?
- Remove /Page/ from slug when we’re visiting 2nd and other inner pages of the blog page
- Create a custom plugin with dynamic child pages listing database records
- Sending the reset password link programatically
- How do I directly access a PHP file located in my themes folder?
- Only show div on homepage/blog index in wordpress/php
- WordPress the_content() return only one image from a specific category
- Display all posts in current category
- file_exists() acting weird
- Is it possible to use the featured image of a page as a css background without inlining?
- PHP syntax error when using wpdb update?
- Select dropdown not showing selected value php
- Woocommerce – How to get products which have a sale between 20% to 40%? [closed]
- Warning: array_pop() expects parameter 1 to be array, boolean given
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- items_wrap not working
- Using shipped version of jquery
- Simple Plugin with custom javascript wont work – no console error
- Using file_get_contents with Gravity Forms uploads folder to create images in the media library returning false
- WP Walker using custom css classes
- Javascript file is not working on single.php wordpress [closed]
- WP CRON duplicate wp_insert_post with has < and > tag
- How to send Ajax request from my plugin in admin dashboard?
- Output Video Download Link in template
- Display category name only once inside loop
- Two menus show up
- Path for php file for inserting data through html form
- How to create pagination for users list using custom array?
- WordPress member notification
- Syntax error in a shortcode function
- Execute a function every hour in the background
- One account with multiple logins
- Can’t get url_to_postid to work
- .html end of URl affected to SEO?
- Comapare get_user_meta value
- How can get all users by current user meta?
- Sort posts in a specific way
- How to get property out of image object
- Only show posts from the last trailing 12 months
- `update_post_meta` not working anymore
- Custom pagination (Previous / Next)
- Post meta select input, if statement
- Set document title through shortcode plugin
- current_time function incorrect in plugin and PHP, not in WordPress admin
- Implementing a multilingual WordPress site by installing several instances of WordPress and redirecting
- Weird fonts showing which are coming from database
- WordPress all php BUT index.php downloads instead of loads
- Don’t update modified post date when user add a product review or comment?
- Mysterious letters appearing at the top of a few pages
- Trouble matching strings (titles) using wp_query
- Using Javascript On Page – Header and Footer Now Missing
- wp_remote_request to url with port 8001 not woorking
- Customizer textarea with script tag won’t work in live preview
- How to give custom roles the capability to edit one Menu instead of every Menu
- Styling a specific post after hovering over it
- WordPress file upload
- PHP tag in post content makes wordpress go crazy
- insert thumbnail image from php script
- widget: input the px value from user and use it as inline style in widget function
- How to call a certain object/menubar in a PHP file
- Setting pages for posts
- Trying to see if page is category or single and displaying title with appropriate heading tag
- Get null from POST
- How to have post count after each listed category
- why is markup routinely placed in functions in wordpress?
- Customise Author Page?
- Is there a way of displaying related posts from lowest hyrachical order (lowest child category to parent category)
- Remove colon from CTP UI “Singular Label”
- Customize create table SQL statement in any WordPress plugin