The Codex is your friend. There’s a the_widget()
function for that.
<?php the_widget( 'MY_Widget', $instance, $args ); ?>
Refer to the Codex entry for values for $instance
and $args
.
$instance = array(
'title' => 'Some Title here',
'name' => 'Some Name here',
'show_info' => true
);
$args = array(
'before_widget' => '', // Your value here
'after_widget' => '', // Your value here
'before_title' => '', // Your value here
'after_title' => '' // Your value here
)
Related Posts:
- Individual Widgets per Page
- Having different sidebar content for MANY pages?
- Add custom fields when specific templates are selected
- Get custom field values into the sidebar/widget?
- passing argument to get_template_part() or a better way to code
- Custom Page Template [closed]
- Best way to allow manageable social media URLS?
- How do you create dynamic customised sections in WordPress?
- Creating a custom menu/widget area
- Creating a widget with a number of custom fields
- List taxonomy term “Last Name” + “First Name” (taxonomy custom field) in a post loop
- Adding an editable field to template?
- How to display image inside container of custom made widget
- Want to make A CSS if meta key value is empty
- how to display a widget only on a page where the custom field is defined?
- What’s the best way to implement custom widgets on a per post basis?
- Is there a way to dump all registered sidebar/widget?
- Add custom data (field) to sidebar widgets for later display
- Custom field outside the loop and inside an array
- Add a field to just ONE page
- How to set up page fields with gutenberg instead of ACF
- How do I update custom field post meta in frontend post template?
- WP_query returns error when used for custom widget
- Add class from custom field into widget class
- Running a Gallery Shortcode in a Custom Fields Widget
- Group pages by custom field values
- RSS Feed in Custom Field
- I would like to display different text on different pages
- How to check if custom field exists in this widget query
- Advanced Custom Fields for Header that are Editable from a Page [closed]
- How to apply Local Business Google Schema dynamically on a Custom Post single template?
- Add fields to edit in custom widget
- How to conditionally change template based on ACF field in WordPress 6.5 with FSE theme?
- Advanced Custom Fields: how do I check to see if a value is set in an field? [closed]
- WP_Query – Order results by meta value
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- getting all values for a custom field key (cross-post)
- How to add a custom field in the advanced menu properties?
- Custom query with orderby meta_value of custom field
- How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?
- Using meta query (‘meta_query’) with a search query (‘s’)
- Can I exclude a post by meta key using pre_get_posts function?
- Add validation and error handling when saving custom fields?
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Show Custom Fields in Quick Edit
- Where are custom field values stored in the database
- Validating Custom Meta Box Values & Required Fields
- Max length of meta_value
- Add custom fields to wp native gallery settings
- How to fix missing custom fields after upgrading to WordPress 4.8.1?
- How to enable custom fields for pages (if not a bad practice)?
- How can I add extra attribute in the ‘Page Attribute’ section in wp-admin for pages?
- Is there a way to set default custom fields when creating a post?
- Custom post meta field effect on the performance on the post
- How to get custom post meta using REST API
- Custom field/meta populated by dropdown of existing posts?
- Difference between meta keys with _ and without _ [duplicate]
- Is there any action filter/hook for validating a custom field before publishing the post?
- Remove Dimension from wp_get_attachment_image
- Orderby meta_value only returns posts that have existing meta_key
- Underscores in custom fields
- What is the index [0] for on post meta fields?
- Custom Post Type Data in Sidebar widgets?
- What is “meta_input” parameter in wp_insert_post() used for?
- Query Posts or Get Posts by custom fields, possible?
- How to enable revisions for post meta data?
- Sortable Custom Columns in User Panel (users.php)?
- Any way to add custom options to Gallery Settings?
- The “_encloseme” Meta-Key Conundrum
- ORDER BY custom field value
- Add subtitle to Woocommerce product title
- Best way to programmatically remove a category/term from a post
- Importing data for advanced custom fields plugin?
- Gutenberg add a custom metabox to default blocks
- SQL Query to copy value of a meta_key into another meta_key
- ‘Preview Changes’ for custom meta boxes?
- Adding a custom field to the site identity menu
- Using TinyMce with textareas in meta boxes on custom post types
- Filter WP_Query for posts having a certain meta-value
- How to correctly call custom field dates into a posts_where filter using SQL statements
- Using get_post_meta with new_to_publish
- Is there a way to get protected meta fields through any of the available built-in WordPress APIs? (xmlrpc, wp-json)
- Add a Jquery Datepicker to custom field in post edit
- add meta box – custom field : which to choose?
- Preserving line breaks when saving and displaying custom fields data
- Where is get_header(‘shop’) file in Woocommerce templates
- How to return Meta data from the REST API?
- Advanced Custom Fields – Get custom fields from parent page
- Can I query custom meta data through WP_Query
- Add custom field to the archive page?
- Saving custom data for each user
- Is it safe to store a user setting you don’t want the user to ever modify as a user option?
- Tabindex on text input immediately after WordPress title input
- Including custom fields in search?
- Add custom fields to search
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- Attaching Metadata to a Taxonomy Item
- Add metabox to document tab in gutenberg
- How to display all custom fields associated with a post?
- How to add add_meta_box to specific Page Template?