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?
- Create a shortcode to display custom post types with a specific taxonomy
- Display custom post type with shortcode
- Add Content to Page without shortcodes
- Change slug of registered custom post type in child theme
- How can I fix those issues generated by the Themecheck plugin
- Custom post types and 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
- How can i list custom post type categories?
- IF statement in a do_shortcode
- Change labels of custom post type via child theme
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- 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
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- Generate Shortcodes by Taxonomy
- Child Theme for Mobile Browsers
- How would I create a shortcode to display a custom post within a page or regular post?
- Is it possible to create a shortcode that will query a post based on taxonomies?
- WP_Query is printing out only one post when posts_per_page is set to multiple
- 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 insertion in tab
- 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
- Plugin: register custom post types, child ready and performance best practices
- making available just some parts of theme option
- Get custom post type list for every category shortcode
- Rewrite post type slug only for child theme
- How do I amend the have_posts function to include custom posts?
- 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
- How to render a custom post type template with custom fields using shortcode
- Form action/link to render a plugin in WordPress front-end
- custom post type category count shortcode
- Display Child Pages of Custom Post Type Parent Page
- Display a list of sub-pages of Custom Post Type Parent Page
- 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
- Child Theme problems
- Plugin Error on activating
- Ads below footer
- Shortcode error
- 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?
- Custom Post Type vs Shortcode: Which one is more performant?
- How to call Shortcode categories for custom post types?
- Cannot modify a registered custom post type rewrite slug
- Custom Post Types and Child Themes!
- Using get_terms() as shortcode attribute
- Having some trouble properly displaying Custom Post Types in templates
- How to add a custom post type in child theme? (WordPress > 3.0)
- adding a shortcode into a custom post type
- Nested loop called with shortcode duplicating the content above the main loop
- Add number in increment of one to DIV ID
- shortcode for recent custom type post
- Create shortcode for list of custom post titles with custom fields alongside
- Creating shortcodes with user created forms
- Navigation links to posts in current term shortcode
- Test if a Category contains certain Custom Post Types
- How to Create Short Code Using Custom Post type
- Adding custom shortcode to page leads to page without styling
- custom post types shortode stays on top of other page contents. Is there a bug?
- 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
- Shortcode in a page to display custom posts which also have a shortcode in them
- How to loop through a custom post type using a shortcode and output each element in the loop using shortcodes
- Passing postid of Testimonial Custom Post in Shortcode Parameter
- How can I show template dropdown in custom post type?
- Display page and custom post title inside shortcode
- trying to display custom post type with custom taxonomy value by shortcode can’t works [closed]
- How to separate posts by categories?
- Problem with shortcode
- strange issue with get_post_type() when using it in a shortcode in text widget
- select categories by ids/display terms only selected
- Custom Field in Page Title
- SOLVED: Shortcode to display Divi project filtered by tag in WP Query loop
- Add Shortcode functionality to a function that queries custom post type / taxonomy
- ACF Pro simple Business Directory – Requesting assistance with created Templates and associated Functions.php Coding
- WordPress display post count for custom post type
- Display the progress of post achievement with percentage against target in wordpress dashboard