add_shortcode( 'type_portfolio', function( $atts, $content = null ){
$atts = shortcode_atts(
array(
'column' => '3',
'category' => '0',
'ppp' => -1
), $atts);
extract($atts);
$args = array(
'posts_per_page' => $ppp,
'post_type' => 'fen_portfolio'
);
if( $category > '0' ){
$args['tax_query'] = array(
array(
'posts_per_page' => -1,
'taxonomy' => 'cat_portfolio',
'field' => 'term_id',
'terms' => $category
)
);
}
$portfolios = get_posts( $args );
Related Posts:
- do_shortcode within post query
- How to convert query sql to shortcode in wordpress?
- How to limit the number of posts that WP_Query gets?
- Stop WordPress automatically adding tags to post content
- Should we trust the post globals?
- Random sort within an already sorted query
- WordPress removing tags?
- how to get a different html for odd/even posts?
- How to know if get_posts() failed?
- WordPress Number of Posts Not Changing With posts_per_page
- Automatically added brs and paragraphs?
- Duplicate posts
- Looping through posts per category gives same posts for each category
- Trying to put an array into ‘post__in’ => array() query not working
- Specific loop in Shortcode
- How to add shortcode tags in single.php [closed]
- Query All users that has post
- Adding variable for post title so post template can include auto-generated link to view on external website.com/{post title}
- How to create shortcode to show the 2 latest posts
- Search query – exact post title match
- Check if post exists
- Remove Shortcode […] from Blog Preview
- Display page content AFTER a loop of posts
- Get posts by multiple ID’s (query)
- How to start with post number x?
- Exclude posts with empty post_content in wp_query
- Only display a certain number of posts, dependent on how many posts there are available in a query
- Display a post by ID attribute with shortcode
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Duplicating Table of Contents for Paginated Post
- WP_Query Authors OR Categories
- How to get rid of shortcodes in post content once and for all
- What’s the best way to render Visual Composer in posts, not pages?
- get query() without post content?
- display-posts shortcode attributes have no effect
- Shortcode and whitespace formatting problem
- Exclude the first ‘n’ number of posts of a tag from home page?
- posts_per_page option limits the number of Gallery items
- How to get posts and comments amount per hour, per year and per month?
- Get all custom post types excepted some…
- Get all comments of author’s posts
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- Counter is skipping post when I still want it visible [closed]
- Can’t get full post title if there a spaces in title
- How to get all post_parents of a post?
- Run query_posts if SESSION is empty?
- How come a YouTube link isn’t transformed into a shortcode inside the post content?
- How to give classname to post if post has no content?
- Exclude some posts from displaying in wp_query based on some condition
- Adjust the order for returned posts
- get last post’s link with SQL query
- post/page content
- Trim posts from WP-Query?
- Custom Select Query – Selecting the Year?
- Trying to exclude custom posts based on date, while sorting by custom field
- WordPress, custom post type and posts query help!
- WordPress Query – Display 5 posts (same post type), each from a given tag
- how to add tags to post in the Loop?
- Shortcode for Comments and Comment Boxes in Post Loop
- Merge get_comments & get_posts into a single query
- shortcode // get posts by ids
- Display “no post” message
- How to optimize posts query in wordpress
- Featured Story Shortcode not outputting content
- How to pull sticky post permalink inside php?
- Display Post from Custom Post Type with Shortcode
- wp_insert_post() Add and specific ID to the body of that
- Ignore posts content in the posts queries for internal linking
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- Add a url parameter to the current post and read it in a shortcode
- I have two post types in the same query, how can I use CSS to select only one post type?
- Secretly passing post ID/title etc into a shortcode form automatically to link submission to post
- Bulk Post update_post_meta
- AJAX load more posts not using correct category and repeating the same few posts
- Numbering author posts in posts query
- How to run select query of post with category and tags?
- Shortcode: How to add custom posts?
- Sort Events by Venue Title – Sort Post set by related post ids
- Query post for today, if no post get the previous one
- Custom Select Query pagination not working properly
- Sort / Filter Queries
- Display the latest post from some selected authors
- Advanced Post Display/Pagination/Ordering
- How to use extract shortcode in loop?
- Displaying Results From Custom Taxonomy Query
- Sort post by category using HTML Select tag
- Get first comment link on the post itself
- WP_Query retrieve custom posts but not the post showing
- Special Query: Title, Terms, Content – %LIKE%
- Make division in post_query?
- Display one post randomly from category on home page
- How do I add an article to specific page?
- get value from post to sidebar
- Insert Shortcode exactly at the end of the content
- How to set value in Query Loop?
- Wp_query WooCommerce products
- Display posts with id equal to relationship value
- Sort Posts Alphabetically Based on Specific Category (Divi)
- Undefined Function Fatal Error with Shortcode [closed]
- How to use shortcode to get the second to newest post?