I´m doing this since last year and i´m getting the shortcodes working:
function my_code() {
ob_start();
get_template_part('loop_logos');
return ob_get_clean();
}
add_shortcode( 'logos', 'my_code' );
where get_template_part loads the file loop_logos.php and logos is the name shortcode [logos].
HINT
When I started to do this I used to name all equal to avoid mistakes, Ex:
function loop_logos() {
ob_start();
get_template_part('loop_logos');
return ob_get_clean();
}
add_shortcode( 'loop_logos', 'loop_logos' );
So I had to worry about to upload the loop_logos.php on the right folder. and call the shortcode with [loop_logos]
Related Posts:
- WordPress loop add heading before first of type
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- Conditional to modify query results
- wp_query to find posts by year and month
- Create a random unique 6 digit number as custom field for custom post type
- Very Slow Page – How to Optimize # of Queries?
- WP_Query orderby modified to include custom meta changes
- How to make sure content doesn’t display if selection is empty
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- How can I group posts by months and years?
- Loop increase number
- Using wp_query to modify the loop in index.php for a CPT
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- Get data from PHP to JavaScript to set position of each post on front page
- foreach loop inside the loop creating duplicates in output
- How do I list a custom field and custom taxonomies for each result in a loop?
- Page that lists publications by classifying them by taxonomy
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- Sort custom post column by generated value?
- when looping through custom post data not appearing
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- sorting in wp query based on custom field value
- WordPress query in which condition uses custom field
- Error in WP Query. If variable is empty it is displaying previous post value
- Strange behavior on WP_query
- get_post_meta for Custom Post Type ( CPT )
- Order by custom field attribute
- Query Custom Post Type by Tag
- How do I filter a custom post type loop by a field?
- Display all posts in a custom post type, grouped by a custom taxonomy
- How to use a custom post type as front page?
- Sorting a query by custom field date
- How can I generate a RSS feed based on a custom WP_Query?
- Retrieving 3 latest post from each of 5 different custom post types
- Search Custom Post Type with all meta attached?
- How to sort CPT by custom meta value (date), and return posts month by month
- How to solve suspected memory issue in custom WordPress loop?
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Display children and grandchildren of a custom post type
- Sort by two dates. Default entry date and custom field if present
- Loop on front-page.php
- WP_Query is printing out only one post when posts_per_page is set to multiple
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Get all Posts If has same custom field values in Posts
- Can’t get order_by meta_value_num to work properly
- WP_Query | ‘post_type’ doesn’t work
- Filter by custom taxonomy slug on a custom post type
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Loop through Custom Post Type, and then show children within each iteration
- Can I create a loop with multiple post types and specify different $args for each post type?
- How can I get the number of custom post type posts that have a specific attachment image set?
- Including metaboxes from custom post types in global search — continued
- pagination not working for category.php (custom post types in categories)
- Query based on custom fields start and end date
- Redirect to another page using contact form 7? [closed]
- WP Query post__in not returning correct results
- DIsplaying URL of custom field in last post of certain taxonomy && post type
- Custon Content within WordPress Loop
- WP Query ‘posts_per_page’
- WP_Query Custom Post Type if Category ID Equals
- get_pagination not working on a custom post type query (using WP_Query)
- WP_Query with custom post type ID
- WP_Query orderby not work with meta_key
- Different options per post type in WP_Query
- Custom Post type loop with ACF not displaying properly
- postsperpage value not being applied
- Using Wp_Query, Json to add Highcharts series data
- Display the current post in browser as the first post in a loop (for a slideshow)
- How do I show my containing my custom field ONLY if there is a set value on that custom field? [closed]
- Let users upload image(s) to the post from front end
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- Cache issue with WP_Query and custom field filtering
- What is the most efficient way to execute recursive complex queries?
- CPT loop doesn’t seem to account for post date?
- Pagination Not Working When Used With WP_Query() `offset` Property
- Search result based on URL
- Post Filtered by Custom Field Value
- subtracting the current post form then whole loop, which is generating all CPT titles
- Custom post Query and WordPress Post Query Clash
- Meta_Query refuses to return results
- Add active class to foundation 6 tabs while looping categories
- Loop carousel slider in wordpress
- Calling specific page with wp query
- Loop with Custom Post Type and Taxonomies
- Function not pulling image or text from custom post type
- WordPress Custom Post Type and sort by Tags
- Trying to combine multiple WordPress queries
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Looping taxonomy in taxonomy?
- 404 on Pages for Custom Post Type & Query_Posts
- Pagination not working on homepage
- Show Posts in Vertical Tabs with Scrollbar
- How to manage wordpress knowledge base/wiki/posts collections
- Get custom post fields and display them
- WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- I want to show image from custom field image on my custom page template