Okay here are the solutions for my problems here for the people having the same problem.
1 – First problem was I was unable to get the shortcode to work in multiple instances and that was because I used include_once at the shortcode function instead of include to include the separate php template.
2 – The second problem was that when I mapped my shortcode inside Visual Composer plugin at output the content generated from my shortcode was outside of the column div.
The solution to this is adding this part of code at the shortcode function.
function postBoxes_1( $atts ){
ob_start();
include('post-layouts/post-box-1.php');
return ob_get_clean();
}
add_shortcode('postBox1','postBoxes_1');
Related Posts:
- How to paginate wordpress [gallery] shortcode?
- What kind of object type is WP_Query?
- Last post ordered by publish date using WP_Query on front page
- Shortcode returns escaped HTML tags
- WP_Query in a shortcode
- ‘&’ causes an error in my shortcode when I list the content of the page
- Can certain (site-crashing) limitations on WP_Query in shortcode be overcome?
- How to retrieve current page WP_Query arguments?
- wp_query add arguments using array_push if variable met
- Category attribute not working in custom shortcode
- How to get all child pages in their parent page?
- Database Queries Optimization with new WP_Query
- Orderby is working with one query but not with other
- Shortcode for latest -not expired- posts
- Gallery shortcode numerical sorting
- How to filter a query by date in a shortcode?
- How should I approach changing the template & $query as part of a shortcode’s execution?
- Shortcode Not Working in Slider When Added To Post Title
- Shortcode for custom query not returning results when attributes are added
- How to Display Shortcode in the correct location, currently displaying before content after Page Title?
- WP_query only displays one of my custom post type entries
- Assign a minimum result count for WooCommerce query shortcodes?
- Using a Shortcode to List Posts from Multiple Categories
- embedding shortcodes in php template
- How to get specific string in explode array?
- Trouble passing attribute into shortcode function
- Woocommerce Shortcode which displays a table with product data
- WP Query by 4 different taxonomies
- create custom shortcode wp and put php code in
- How to display a post(by id) along with css in a page?
- Shortcode attributes causes 500 error after updating the page
- pages shortcode filtering by category
- WP_Query & shortcode : Return 3 articles from a category WordPress
- Query by Category and Custom Field – Shortcode
- How to take parameters from a function and make them editable as attributes in a shortcode
- How to modify WP Query to target the first most recent post to adjust content
- Object of class WP_Query could not be converted to int inside shortcode
- Get Current CPT taxonomy category in shortcode
- Custom shortcode not displaying categories and correct date
- return wp query results in a shortcode
- More efficient query to display posts in same sub-category?
- Having Trouble Running Query From Shortcode Using Tribe’s Events Plugin
- shortcode using multiple WP_Query’s with multiple category names not fully functional
- Shortcode does not display pagination [duplicate]
- How to write a query-function as a query-shortcode?
- shortcode with $atts with strange results
- WP_query shortcode inside acf Repeater breaks the repeater loop
- How to prevent WP query searching in executed shortcodes
- Exclude post ID from wp_query
- Meta Query with date and time on the same Day before given time
- In loop: posts have thumbnail AND other variables
- Add and in the header while looping over custom query in page template
- WordPress pagination link always leads to home page
- Query posts with more than 20 comments
- Implementing an OR statement to wordpress wp_query
- How can i simulate “taxonomy__in” in query?
- How to show subcategories using loop?
- Minimize database queries to user tables?
- Get all products which have both product category
- How to make Meta Query case sensitive?
- Populate tax_query terms parameter with post term
- Fastest way of counting posts of a custom post type in a specific taxonomy term?
- wp_query ‘s’, search filter with pagination is not working
- Modify wp-query and sort by post meta key
- How to display an other custom post type in a different custom post type’s archive?
- Replacing raw database query to WP_Query
- WP CLI can’t delete plugin related table
- Change query from cat id to slug or name?
- Query only the posts with a post format of “audio”
- Display Current Post’s Position in Custom Taxonomy
- Custom WP_Query id
- Set post number to single posts
- Orderby custom meta returns random order
- Intiger meta value with ‘>=’ returns posts with lower value
- Update query for wp_posts and wp_postmeta
- How to print term name inside wp post loop
- Grabbing taxonomy terms and inserting them into an array
- WP_Query with page_ids in arguments without a result
- JOIN filter doesn’t work in WP_Query in wp-ajax calls
- Why is my pagination /page/2 taking me to index.php?
- Customize the Sorting Dropdown in WooCommerce use another list or more page
- How to wp_query every Sunday between a startdate and enddate?
- Why last row deleted when refresh page
- Meta query orderby meta_value_num sorting by role first
- Add to search posts query array with post IDS which will appear first
- Can’t reset the secondary query by wp_reset_postdata()
- Wp_query ordering problem
- Letting wordpress decide what template and page to use based on condition
- Why does the theme insert the comments section if I don’t reset my custom WP_Query?
- Get post Number with local loop and template
- WP_Query tax_query only returning posts that match first term
- Get post related to current post
- How To Query All Attachment Images Found In Post Galleries
- WordPress meta_query not working
- $wp_query when new WP_Query
- Unable to pass variable
- Edit WordPress loop, taxonomies, & filter
- WordPress website links redirect to homepage
- How to display posts from a specific term first then another posts from another terms using tax_query
- wp_query, calculate with two dates when ‘key’ is text format