I want to load content from another table into wp_posts and then show it as a normal page. What solution do you recommend.
If that’s your goal, then use shortcodes!
For example:
// PHP code
add_shortcode( 'footag', 'wpdocs_footag_func' );
function wpdocs_footag_func( $atts ) {
return "foo = ".$atts['foo'];
}
Then in your content:
[footag foo=”bar”]
This prints foo = bar
on the frontend
The [footag]
will get replaced by what your shortcode function returns, and it’ll happen when the page is generated. You can pass attributes to it too
Read more about add_shortcode
and check the examples at the official docs here:
https://developer.wordpress.org/reference/functions/add_shortcode/
Related Posts:
- Create page when plugin is activated
- Replace existing pages with new pages, keep menu links
- Distributing and packaging plugins
- Copyright messages for a particular set of pages
- View Private Published Page with URL Code (no login required)
- Advanced WordPress plugin activation detection
- What is the best way to make a custom page from a plugin?
- Elementor: How to design Dropdown Select Box Navigation page like Chegg
- Give custom page template a custom post ID
- Adding LOAD MORE on a page
- Best approach to serve static content within a regular page
- Restrict my pages from public
- Problems with installing and deleting plugins
- Delete tables from database when deleting plugin
- Show a confirm message before plug-in activation
- Best way to manage a lot of pages in Wp Admin [closed]
- WordPress Plugin as ‘Library’ From Abstract Application?
- Custom comment type maybe?
- Add custom meta box on Post page
- Posts wont expire
- plugin for wp_list_categories with posts
- Is there a way to lock certain pages from being edited by anyone other then the admin?
- How to get last_updated and newest_blogs in WP 3.0
- [Plugin: Posts 2 Posts] How does it work?
- Will Flutter work with WordPress 3.0?
- How can plugins have their own pages?
- Plugin won’t activate – cannot declare class (already in use)
- How to modify shortcode attributes with data from current post
- Is any information available in PHP files in WP about plugin activation history?
- Anonymous Postings
- How to check if tables in WordPress still exists after activations
- WordPress web pages keep getting deleted (moved into the trash) by themselves
- Best place for short bio,image and button [closed]
- Automatic Updates Individual Plugins Not Working
- How create Group Blogs based on user created Groups
- Why this function not working for install database on plugin activation
- WordPress as web application base
- URL rewrite of independent plugin?
- Plugin for users to create their own ads like Google Adsence
- Can I allow certain people to add/edit pages within a parent?
- How do I apply style to each category of a list?
- Run function on plugin activation before plugin is loaded
- Best practice for including plugin output in a template without using shortcode?
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- A question about register_activation hook
- Custom widget doesn’t save values from dropdown box
- Plugin function inside custom plugin
- Change the style of h1, h2, only in post entry
- Simulating a wp page – wp page load sequence
- Custom API plugin to execute 3rd party API to retrieve data
- Customize Menu | Styling LESS/SCSS code formats
- shortcode – multiple instances of same parameter name in one shortcode instance
- How to create a plugin that includes all the other plugins?
- Why is it important to check for isset and is_array before checking in_array in this example?
- how to change wp-admin url using function file
- How Should Custom Functions Be Called For Single Posts?
- same user role or copy the user role to be same as the other role
- Custom form not showing in correct place on page
- Use jQuery Datepicker code from plugin
- How to force load a page in plugin?
- Want to modify a Plugin – Tweetily – Can I make it tweet a Custom Field instead of Post Title?
- Integrating Custom Database with WordPress
- Is there a syntax highlighting plugin for HTML View? [duplicate]
- How can I replace content on site generated from plugin without changing plugin
- Edit post image attributes on fly?
- How to permanently show Word Counter on Create/Edit Page. WordPress5.9.3
- How to make PDF books readable on site with woo-commerce?
- Copy/paste local images not working in WordPress
- create pages automatically and dynamically in wordPress
- Replace only the first CSS class
- Ultimate Members Default Post Layout problem
- how to enable/activate a plugin per Cpanel
- My WordPress activation hook isn’t working
- How to allow URL with filename & extension in wordpress?
- How to send custom mail when a user complete a specific form
- Echo custom admin field into a is_single()
- Manual Backup – How to save to Firefox or Chrome (instead of IE which brings up popup I can’t get rid of)
- How can I save cookies to members
- Am I using an action hook correctly?
- Error Copying Directory On Plugin Activation
- Options page textarea to populate custom post select field
- Conditional required fields for WordPress Contact Form 7
- Better code/text editing for posts and pages?
- Replace code in plugin template
- Display_rows() and column_cb() strange behaviour
- Directory structure for plugin changes
- How can I pass value to function in add_menu_page?
- disable lightbox in a plugin [closed]
- Need Help Creating a Multi-Step, Video-Guided Enrollment Site
- How to set different users for different pages?
- User specific content (posts) / limiting visibility
- Remove the ‘Press This’ Tool
- How wordpress plugin hooks works? [duplicate]
- Selling Downloadable Products [closed]
- How to delete remain data in WP database after deleting custom post via admin interface
- How can I modify the colors of my theme for a single section of my site? [closed]
- How to generate a responsive output from plugin?
- Need help saving input fields for Security Deposit plugin in WC Vendors page
- Looking for membership style plugin with edit option [closed]
- How to Add Extra Text In WordPress Title Before Post Publish