Posts
Register custom post types, with minimal requirements
Register custom post types, with minimal requirements
register_post_type( 'agiledrop',
array(
'labels' => array(
'name' => __( 'Jobs', 'textdomain' ),
'singular_name' => __( 'Job', 'textdomain' ),
),
'public' => true,
'has_archive' => true,
)
);
Get all posts from custom post type
$posts = get_posts( array( 'numberposts' => -1, 'post_type' => 'custom_post_type' ) );
Get a list of all public registered post types
$post_types = get_post_types( array( 'public' => true ) );
Get a list of all registered custom post type
$custom_post_types = get_post_types( array( '_builtin' => false ) );
Get the post thumbnail URL
$thumbnail_url = get_the_post_thumbnail_url( get_the_ID() );
Force delete post
wp_delete_post( $post_id, true );
Move post to trash
wp_trash_post( $post_id );
Get child pages of current page
$child_pages = get_pages( array( 'child_of' => $post->ID ) );
Add meta box
add_meta_box(
'agiledrop-video',
__( 'Featured Video', 'themedomain' ),
'metabox_callback',
'agiledrop-hero',
'side',
'low'
);