Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress post type template

// ON your wp-content/themes/theme_name ADD:
archive-{post-type-name}.php
// Example: archive-musicians.php
// Inside the file you should copy the archive.php or category.php 
Comment

how to wp create post type in wordpress


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Our custom post type function
function create_posttype() {
 
    register_post_type( 'movies',
    // CPT Options
        array(
            'labels' => array(
                'name' => __( 'Movies' ),
                'singular_name' => __( 'Movie' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'movies'),
            'show_in_rest' => true,
 
        )
    );
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
Comment

PREVIOUS NEXT
Code Example
Php :: php datetime add 1 weeek 
Php :: Redirect to external domain in Laravel 
Php :: php switch case array 
Php :: laravel custom validation exception 
Php :: is_unique in codeigniter form validation 
Php :: php print array nice format 
Php :: php set title dynamically 
Php :: laravel-cors 
Php :: phpmyadmin username password check 
Php :: php shorten string with dots 
Php :: php autoload classes 
Php :: format a number with leading zeros in php 
Php :: guzzlehttp/guzzle version with laravel-websockek 
Php :: pagination php mysql 
Php :: comments in php 
Php :: Group by not working - Laravel 
Php :: php variable in echo 
Php :: laravel observer 
Php :: php gethostname 
Php :: json encode decode php 
Php :: check mobile or email in laravel 
Php :: Enqueue WordPress Scripts and Styles 
Php :: laravel exist 
Php :: php define multiple variables as 0 
Php :: laravel elequent get 
Php :: laravel factory 
Php :: php redirect with query string 
Php :: associate laravel 
Php :: laravel livewire-datatable delete column pop up issue 
Php :: wpml get site url 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =