I believe you can do something like this (not tested):
if($_SERVER['REMOTE_ADDR']=="89.0.0.0" && $post->ID==15){
$post5 = get_post('5');
echo $post5->post_title;
//Call custom meta using $post5->ID;
}
Update: If you’d like to replace the original object you can do the following:
if($_SERVER['REMOTE_ADDR']=="89.0.0.0" && $post->ID==15){
global $post;
$post = get_post('5');
setup_postdata($post);
//Here you can call for the_content() or the_title etc.
wp_reset_postdata(); //This function will bring back the old post id
}
Related Posts:
- single-{$post_type}-{slug}.php for custom post types
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- tag.php doesn’t work with tags on a custom post type post?
- Assign single template to multiple custom post types?
- Add Content to Page without shortcodes
- Multiple Single Post templates
- How to set a fall back template for a custom post type in a plugin?
- Custom taxonomy query for a custom post type
- How to list/show all custom post types regardless of category?
- Need some templating advice for templating with custom post types and taxonomies
- Custom Post Type with Nested Taxonomy and Template Files
- Template tags to display custom post type posts in category template?
- How do I create new content pages for my Custom Post Type?
- custom post type archive template per custom taxonomy term
- Custom post type loops with different page templates
- Display posts of child category in template
- custom taxonomy – Template not working
- Create separate template for shared custom taxonomy with shared terms
- Custom Post Type Templates?
- Custom Post Type .current-menu-item not applying on Custom Post Type Archive Page
- wordpress 3.4 template files in subdirectories
- Lock post meta block at the bottom of a custom post type
- How do I provide a “show all posts” link in a paginated term archive?
- I am trying to output portfolio items with a picture. This code doesn’t seem to be working. What am I doing wrong?
- Help with CPT template pagination
- How can I force custom post type to use a specific template?
- Multiple templates for a custom post type
- Merge multiple custom post types in a single archive template
- Trying to edit the single page from a Custom Post
- Plugin templates in which directory
- Using wordpress template tags within an array
- Include custom post type single template, but respect theme override of template if it exists
- Custom post type not using custom template
- Custom Post Type template stored in plugin folder not showing in post attributes dropdown
- How to clone the “Projects” Custom Post type in Divi theme
- Query with no terms uses index.php template instead of archive.php
- Create template for taxonomy results limited by Custom Post Type
- WordPress Custom Post Type Children Template
- Getting template_include to work when allow_url_include is off?
- 2 Templates 1 custom post type according url
- How to use custom template files in deeper directory?
- Migrating a taxonomy’s tags to the native category
- How can I get this request to use the Custom Post Type page template instead?
- Custom templates for a specific category
- Custom posts template page
- How can I use archive-{post_type}.php theme template?
- Add Previous/Next Buttons to CPT Single Pages Only
- Creating separate feeds for custom post types
- How to get_term_meta on single custom post?
- How do I find a way to create a global single.php for a custom post type?
- How do I assign a block template (.html) to a custom post type?
- Templates for hierarchical custom post type
- How to use single.php for creating, reading and editing Custom Posts with ACF
- Custom Post Type setup
- Apply template by path/slug related to custom post type?
- How to get the current category with custom posts
- Assign a template to a custom post type when displayed by the main loop on the home page
- Custom Post Type homepage template
- How to create a archive template for custom post type [duplicate]
- WP not recognizing custom post type / template
- Create a custom taxonomy template that loops through child categories in term order?
- Display Posts Query with IF function
- My template won’t apply, theme still fallback to index.php
- Set generic reservation form for custom post type
- One Custom Post Type two different Templates
- handling templates and widgets for custom content types
- Conflict in function to allow single post template based on category
- How to make post templates to include shortcodes only?
- On click some element i want to use some template
- Post template with breadcrumb needs to show page navigated from
- Accessing download link from the loop with WP Download Manager Pro
- Warning , Use of undefined constant PLUGIN_PATH?
- Turning archive templates to a page template maintaining the slug
- Custom taxonomy template for custom fields loop [closed]
- get_permalink() of page the enclosing page not posts
- WordPress Custom Post Type – Post Attribute: Template. Template shows up and saves on the back end, but the default theme file is being rendered
- Single taxonomy for different custom post types
- How to Create a Default Fixed Custom Posts layout for text and images
- Why did permalinks setting affect the pages?
- How should i name the .php file to show custom posts under a taxonomy’s term?
- How to make a custom search template for custom taxonomy?
- Custom post type with two templates
- Custom Post Type tag taxonomy “Page Not Found”
- DIVs not showing correctly on CPT?
- Why isn’t my custom post type using the corresponding custom post template?
- template structure for CPT not clear
- Load different template for CPT (in loop) in my plugin?
- Search page for custom post type
- Having some trouble properly displaying Custom Post Types in templates
- query_post while (have post) get_template_part()?
- Custom Post Type Template based on Taxonomy
- Template with Custom Post Type (Custom Tables) does not work
- Specifying Default Template for Hierarchal Custom Post Type [duplicate]
- Most appropriate way to display CPT’s by children terms of custom taxonomies while retaining desired permalink structure?
- how to pass args for archive.php query?
- Navigation links to posts in current term shortcode
- CPT Template Option to Top
- How to create custom page templates with default page layout framework?
- Custom post type is_singular condtional not working when managing sidebar display
- Why isn’t page attributes dropdown not showing up in a custom post type