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
- How to create a three column blog layout with a single query and with three different classes?
- WP_Query: Exclude hidden products from WooCommerce product list
- Conditional arguments for WP_Query and tax_query depending on if $somevar has a value
- Combining two wordpress queries with pagination is not working
- query to find “parent” posts of CPT A while filtering “child” posts of CPT B
- next_posts_link not working for loop called with ajax
- Identify which loop you are hooking into; primary or secondary?
- tax_query in WP_Query problem
- Pagination is not working using WP_Query
- view queries made?
- Filter and list posts of a custom taxonomy
- How to show recent and upcoming birthdays using meta_query
- Get custom posts with certain ids in a custom loop using a shortcode
- How WordPress attaches its Featured Images with posts?
- Have functions work outside the loop with 404 override
- Iterating through $wpdb query without using get_results for large query results
- Loop Performance > JSON files vs. WP_Query vs. REST API
- Filter wordpress post categories with jquery/ajax and pagination?
- Include current post into loop
- How to display the featured image for each post?
- How do I amend wp_query before it is run/executed?
- Post Thumbnail URL isn’t pulling into the background of div
- Pagination on template page for custom query redirecting to index.php
- how to get Nearby zipcode
- Exclude authors IDs from WP_Query
- Reload Query Loop When FacetWP Uncheck [closed]
- WP Query Compare cutting off last 2 dates
- Exec wp query in slow motion to avoid memory error?
- Wpdb->query result show 1 but is not an integer
- Remove post type filter added by the plugin in the final query
- How to get more data of a post by wp_query
- WP_User_Query orderby meta_val_num
- Query Taxonomy By Page Title
- WP_Query custom order and pagination
- Why is the value zero going in my custom database table?
- Determine if ID is page or post and query the ID
- get_children() Archive Template
- Search filter between promo and exact price
- Bootstrap grid while loop
- Pre get posts sort by meta key returns no results if meta key does not exist
- meta_query with relation = AND not working as expected when combining EQUALS with NOT EQUALS
- How to define a custom hierarchy for terms?
- WP_User_Query not searching numbers?
- orderby in WP_QUERY – Use the order from the Dashboard
- Escaping WP_Query tax_query when term has special character(s)
- Loop through multiple custom fields with increasing number
- Different number of posts showing in development vs production server
- Order WP_Query results in order other than ASC or DESC
- Get post closest to today
- Pagination in custom query not working [duplicate]
- $query_args for loop to only get posts from “current category”?
- Show number of posts AND number on current page (cannot make it work)