The problem is with the require_once, you are passing a relative path and that path doesn’t exist.
Assuming the test.php file you want to require is in this path
wp-content/themes/your-theme/views/test.php
You can use the following
require_once locate_template('views/test.php');
Consider using include instead of require_one, if this shortcode is not 100% necessary for your site to function, its best to use include as this way you will not receive a fatal error because that file doesn’t exist.
Related Posts:
- Where to put my code: plugin or functions.php?
- Change slug of registered custom post type in child theme
- Shortcode Displaying Custom Post Types
- Add pre-existing meta box to new custom post type
- WordPress Custom Shortcode Conflicting with Media Library
- How to remove thumbnail sizes for specific post type on a child theme?
- Using shortcodes to parse POST request (containing the data from a front-end form)
- Custom Select Query with Custom Post Types
- IF statement in a do_shortcode
- Change labels of custom post type via child theme
- Strip shortcode from specific post types (formats)
- Pagination in a Shortcode. Get_next_posts_link not working but get_previous_posts_link works fine right next to it
- Generate Shortcodes by Taxonomy
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Get custom posts with certain ids in a custom loop using a shortcode
- Custom Post Type Loop within Shortcode
- Create a post in custom post type using field in registration form after users submit form
- Shortcode doesn’t display in custom post type
- Add category attribute to custom shortcode
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- How to create shortcode to display custom field value on a custom post type
- How to enable shortcodes in a custom post type?
- Get custom fields from a custom post type with a shortcode
- Shortcode for display posts in wp-editor
- Display Recently Added Custom Post Types with Custom Taxonomy Shortcode
- making available just some parts of theme option
- Get custom post type list for every category shortcode
- Don’t know how to show custom taxonomies from a custom post_type
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- Form action/link to render a plugin in WordPress front-end
- custom post type category count shortcode
- Shortcode for CPT post content in a page
- Can a shortcode included in post content add styles to the ?
- How to retrieve category of a post in have_post loop?
- Checking if looped item has a parent inside a shortcode
- the_post() is printing titles in page footer
- Add custom attributes to a post
- How can I add a shortcode to query Custom Post Type with ACF in WordPress?
- Get Posts by Category, Tag , and CPT Taxonomy
- why post_class() function apply css classes to all other files?
- post_type internal ID?
- Child theme blocks post from publishing [closed]
- Shortcode is displaying the content on top of the page [duplicate]
- Filter content in shortcode
- Shortcode with WP_Query more than once on one page
- Removed custom post type archive page shows blog page
- What happens to my older posts if I switch to a child theme?
- How to call a post’s metadata in shortcode.php?
- Looking to Customize YouTube Video Embeds
- Trying to write shortcode with get_post_meta but isn’t working
- Shortcode / WP_Query in post changes context
- How to create a archive template for custom post type [duplicate]
- Custom Post Type or Shortcode, What to choose? [closed]
- Modify a plugin function output from another plugin
- Problems making shortcode with custom post types and taxonomy
- Using Custom Post Meta Values in Shortcode
- Content in WP Editor displayed below CPT shortcode [duplicate]
- How to make post templates to include shortcodes only?
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- How to show Custom Post Type – Case Study using Shortcode & ACF
- Get only parent post in archive post
- Alike Shortcode using in Custom Shortcode
- Display CPT Category List as Shortcode
- Can Someone help me to create Short Code for displaying a category posts
- Shortcode with loop stacks output
- background featured image display using shortcode
- How to display the post using a shortcode in WordPress?
- How can I use javascript in specific posts without relying on a plugin?
- WordPress shortcode to pull product post data
- Auto generate excerpt from ACF field on a CPT that does not support excerpt or content
- How to generate auto shortcode for custom post type same as Elementor Template?
- Button link display in shortcodes using custom field in ACF
- How to use POST method using custom wordpress button?
- Shortcode and get_template_part
- WordPress post not executing shortcode until updated
- Do not parse shortcode in CPT
- Shortcode in excerpt
- Extracting Post ID and passing through as an attribute in a shortcode
- Enable shortcodes on custom post type
- Custom meta box in editor of custom post type not working
- custom post type does not working when adding in child theme function
- Plugin Error on activating
- Ads below footer
- Modify shortcode to work with custom taxonomies and slugs
- Custom Info Box at end of posts?
- shortcode order for event custom post type
- Shortcodes in custom post fields without the_content()
- Shortcode display CPT Query only showing 1 post?
- Cannot modify a registered custom post type rewrite slug
- Custom Post Types and Child Themes!
- Using get_terms() as shortcode attribute
- shortcode for recent custom type post
- Navigation links to posts in current term shortcode
- How to Create Short Code Using Custom Post type
- Rewrite a filter as shortcode (or something like that) to use anywhere in CPT
- Display posts from another page on home page in wp-editor
- How to loop through a custom post type using a shortcode and output each element in the loop using shortcodes
- strange issue with get_post_type() when using it in a shortcode in text widget
- select categories by ids/display terms only selected
- ACF Pro simple Business Directory – Requesting assistance with created Templates and associated Functions.php Coding