php - How to use condition for custom post in Wordpress -
i create custom post named portfolio-items. want utilize in condition. if there portfolio-items show items. otherwise show default data. showing user here can come in portfolio.i create things , can come in info admin panel. cannot understand how set condition.
how this?please help me.
thanks in advance.
you need utilize function
function get_portfolio(){ global $wpdb; $result = $wpdb->get_results( "select id wp_posts post_type='portfolio-items'", object ); homecoming $result ; } if $result not empty have portfolio-items. makes condition.
php wordpress custom-post-type
No comments:
Post a Comment