├── .gitignore ├── .babelrc ├── .DS_Store ├── package.json ├── index.php ├── includes ├── skills-tax.php ├── project-type-tax.php └── portfolio-post-type.php └── gulpfile.babel.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | packaged 4 | .DS_Store -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ "@babel/preset-env" ] 3 | } -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alialaa/post-types/HEAD/.DS_Store -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "post_types", 3 | "theme": "firsttheme", 4 | "version": "1.0.0", 5 | "description": "", 6 | "main": "index.js", 7 | "directories": { 8 | "lib": "lib" 9 | }, 10 | "scripts": { 11 | "start": "gulp", 12 | "build": "gulp build --prod", 13 | "bundle": "gulp bundle --prod" 14 | }, 15 | "author": "", 16 | "license": "ISC", 17 | "devDependencies": { 18 | "@babel/core": "^7.9.0", 19 | "@babel/preset-env": "^7.9.5", 20 | "@babel/register": "^7.9.0", 21 | "babel-loader": "^8.1.0", 22 | "del": "^5.1.0", 23 | "gulp": "^4.0.2", 24 | "gulp-clean-css": "^4.3.0", 25 | "gulp-if": "^3.0.0", 26 | "gulp-imagemin": "^7.1.0", 27 | "gulp-replace": "^1.0.0", 28 | "gulp-sass": "^4.0.2", 29 | "gulp-sourcemaps": "^2.6.5", 30 | "gulp-uglify": "^3.0.2", 31 | "gulp-zip": "^5.0.1", 32 | "vinyl-named": "^1.1.0", 33 | "webpack-stream": "^5.2.1", 34 | "yargs": "^15.3.1" 35 | }, 36 | "dependencies": { 37 | "slick-carousel": "^1.8.1" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | esc_html_x('Skills', 'taxonomy general name', '_themename-_pluginname'), 5 | 'singular_name' => esc_html_x('Skill', 'taxonomy singular name', '_themename-_pluginname'), 6 | 'search_items' => esc_html__('Search Skills', '_themename-_pluginname'), 7 | 'all_items' => esc_html__('All Skills', '_themename-_pluginname'), 8 | 'parent_item' => esc_html__('Parent Skill', '_themename-_pluginname'), 9 | 'parent_item_colon' => esc_html__('Parent Skill:', '_themename-_pluginname'), 10 | 'edit_item' => esc_html__('Edit Skill', '_themename-_pluginname'), 11 | 'update_item' => esc_html__('Update Skill', '_themename-_pluginname'), 12 | 'add_new_item' => esc_html__('Add New Skill', '_themename-_pluginname'), 13 | 'new_item_name' => esc_html__('New Skill Name', '_themename-_pluginname'), 14 | 'menu_name' => esc_html__('Skills', '_themename-_pluginname'), 15 | ]; 16 | $args = [ 17 | 'hierarchical' => false, 18 | 'labels' => $labels, 19 | 'show_admin_column' => true, 20 | 'rewrite' => ['slug' => 'skills'], 21 | ]; 22 | register_taxonomy('_themename_skills', ['_themename_portfolio'], $args); 23 | } 24 | add_action('init', '_themename__pluginname_register_skills_tax'); -------------------------------------------------------------------------------- /includes/project-type-tax.php: -------------------------------------------------------------------------------- 1 | esc_html_x('Project Type', 'taxonomy general name', '_themename-_pluginname'), 6 | 'singular_name' => esc_html_x('Project Type', 'taxonomy singular name', '_themename-_pluginname'), 7 | 'search_items' => esc_html__('Search Project Types', '_themename-_pluginname'), 8 | 'all_items' => esc_html__('All Project Types', '_themename-_pluginname'), 9 | 'parent_item' => esc_html__('Parent Project Type', '_themename-_pluginname'), 10 | 'parent_item_colon' => esc_html__('Parent Project Type:', '_themename-_pluginname'), 11 | 'edit_item' => esc_html__('Edit Project Type', '_themename-_pluginname'), 12 | 'update_item' => esc_html__('Update Project Type', '_themename-_pluginname'), 13 | 'add_new_item' => esc_html__('Add New Project Type', '_themename-_pluginname'), 14 | 'new_item_name' => esc_html__('New Project Type Name', '_themename-_pluginname'), 15 | 'menu_name' => esc_html__('Project Types', '_themename-_pluginname'), 16 | ]; 17 | $args = array( 18 | 'labels' => $labels, 19 | 'hierarchical' => true, 20 | 'show_admin_column' => true, 21 | 'rewrite' => array('slug' => 'project_type') 22 | ); 23 | register_taxonomy('_themename_project_type', ['_themename_portfolio'], $args); 24 | } 25 | 26 | add_action('init', '_themename__pluginname_register_project_type_tax'); -------------------------------------------------------------------------------- /gulpfile.babel.js: -------------------------------------------------------------------------------- 1 | import gulp from "gulp"; 2 | import yargs from "yargs"; 3 | import sass from "gulp-sass"; 4 | import cleanCSS from "gulp-clean-css"; 5 | import gulpif from "gulp-if"; 6 | import sourcemaps from "gulp-sourcemaps"; 7 | import imagemin from "gulp-imagemin"; 8 | import del from "del"; 9 | import webpack from "webpack-stream"; 10 | import uglify from "gulp-uglify"; 11 | import named from "vinyl-named"; 12 | import zip from "gulp-zip"; 13 | import replace from "gulp-replace"; 14 | import info from "./package.json"; 15 | 16 | const PRODUCTION = yargs.argv.prod; 17 | 18 | const paths = { 19 | styles: { 20 | src: ["src/assets/scss/bundle.scss"], 21 | dest: "dist/assets/css" 22 | }, 23 | images: { 24 | src: "src/assets/images/**/*.{jpg,jpeg,png,svg,gif}", 25 | dest: "dist/assets/images" 26 | }, 27 | scrips: { 28 | src: ["src/assets/js/bundle.js"], 29 | dest: "dist/assets/js" 30 | }, 31 | other: { 32 | src: [ 33 | "src/assets/**/*", 34 | "!src/assets/{images,js,scss}", 35 | "!src/assets/{images,js,scss}/**/*" 36 | ], 37 | dest: "dist/assets" 38 | }, 39 | package: { 40 | src: [ 41 | "**/*", 42 | "!.vscode", 43 | "!node_modules{,/**}", 44 | "!packaged{,/**}", 45 | "!src{,/**}", 46 | "!.babelrc", 47 | "!.gitignore", 48 | "!gulpfile.babel.js", 49 | "!package.json", 50 | "!package-lock.json" 51 | ], 52 | dest: "packaged" 53 | } 54 | }; 55 | 56 | export const clean = () => del(["dist"]); 57 | 58 | export const styles = () => { 59 | return gulp 60 | .src(paths.styles.src) 61 | .pipe(gulpif(!PRODUCTION, sourcemaps.init())) 62 | .pipe(sass().on("error", sass.logError)) 63 | .pipe(gulpif(PRODUCTION, cleanCSS({ compatibility: "ie8" }))) 64 | .pipe(gulpif(!PRODUCTION, sourcemaps.write())) 65 | .pipe(gulp.dest(paths.styles.dest)); 66 | }; 67 | 68 | export const images = () => { 69 | return gulp 70 | .src(paths.images.src) 71 | .pipe(gulpif(PRODUCTION, imagemin())) 72 | .pipe(gulp.dest(paths.images.dest)); 73 | }; 74 | 75 | export const watch = () => { 76 | gulp.watch(["src/assets/scss/**/*.scss", "includes/**/*.scss"], styles); 77 | gulp.watch(["src/assets/js/**/*.js", "includes/**/*.js"], scripts); 78 | gulp.watch(paths.images.src, images); 79 | gulp.watch(paths.other.src, copy); 80 | }; 81 | 82 | export const copy = () => { 83 | return gulp.src(paths.other.src).pipe(gulp.dest(paths.other.dest)); 84 | }; 85 | 86 | export const scripts = () => { 87 | return gulp.src(paths.scrips.src) 88 | .pipe(named()) 89 | .pipe(webpack({ 90 | module: { 91 | rules: [ 92 | { 93 | test: /\.js$/, 94 | use: { 95 | loader: 'babel-loader', 96 | options: { 97 | presets: ["@babel/preset-env"] 98 | } 99 | } 100 | } 101 | ] 102 | }, 103 | output: { 104 | filename: '[name].js' 105 | }, 106 | externals: { 107 | jquery: 'jQuery' 108 | }, 109 | devtool: !PRODUCTION ? "inline-source-map" : false, 110 | mode: PRODUCTION ? 'production' : 'development' 111 | })) 112 | .pipe(gulpif(PRODUCTION, uglify())) 113 | .pipe(gulp.dest(paths.scrips.dest)); 114 | } 115 | 116 | export const compress = () => { 117 | return gulp 118 | .src(paths.package.src, { base: "../" }) 119 | .pipe(replace("_pluginname", info.name)) 120 | .pipe(replace("_themename", info.theme)) 121 | .pipe(zip(`${info.theme}-${info.name.replace("_", "-")}.zip`)) 122 | .pipe(gulp.dest(paths.package.dest)); 123 | }; 124 | 125 | export const dev = gulp.series(clean, watch); 126 | export const build = gulp.series(clean); 127 | export const bundle = gulp.series(build, compress); 128 | 129 | export default dev; 130 | -------------------------------------------------------------------------------- /includes/portfolio-post-type.php: -------------------------------------------------------------------------------- 1 | esc_html_x( 'Portfolio', 'Post type general name', '_themename-_pluginname' ), 7 | 'singular_name' => esc_html_x( 'Portfolio Item', 'Post type singular name', '_themename-_pluginname' ), 8 | 'menu_name' => esc_html_x( 'Portfolio', 'Admin Menu text', '_themename-_pluginname' ), 9 | 'name_admin_bar' => esc_html_x( 'Portfolio Item', 'Add New on Toolbar', '_themename-_pluginname' ), 10 | 'add_new' => esc_html__( 'Add New', '_themename-_pluginname' ), 11 | 'add_new_item' => esc_html__( 'Add New Portfolio Item', '_themename-_pluginname' ), 12 | 'new_item' => esc_html__( 'New Portfolio Item', '_themename-_pluginname' ), 13 | 'edit_item' => esc_html__( 'Edit Portfolio Item', '_themename-_pluginname' ), 14 | 'view_item' => esc_html__( 'View Portfolio Item', '_themename-_pluginname' ), 15 | 'view_items' => esc_html__( 'View Portfolio Items', '_themename-_pluginname' ), 16 | 'all_items' => esc_html__( 'All Portfolio Items', '_themename-_pluginname' ), 17 | 'search_items' => esc_html__( 'Search Portfolio Items', '_themename-_pluginname' ), 18 | 'parent_item_colon' => esc_html__( 'Parent Portfolio Items:', '_themename-_pluginname' ), 19 | 'not_found' => esc_html__( 'No Portfolio Items found.', '_themename-_pluginname' ), 20 | 'not_found_in_trash' => esc_html__( 'No Portfolio Items found in Trash.', '_themename-_pluginname' ), 21 | 'featured_image' => esc_html_x( 'Portfolio Item Image', 'Overrides the “Featured Image” phrase for this post type. Added in 4.3', '_themename-_pluginname' ), 22 | 'set_featured_image' => esc_html_x( 'Set portfolio item image', 'Overrides the “Set featured image” phrase for this post type. Added in 4.3', '_themename-_pluginname' ), 23 | 'remove_featured_image' => esc_html_x( 'Remove portfolio item image', 'Overrides the “Remove featured image” phrase for this post type. Added in 4.3', '_themename-_pluginname' ), 24 | 'use_featured_image' => esc_html_x( 'Use as portfolio item image', 'Overrides the “Use as featured image” phrase for this post type. Added in 4.3', '_themename-_pluginname' ), 25 | 'archives' => esc_html_x( 'Portfolio archives', 'The post type archive label used in nav menus. Default “Post Archives”. Added in 4.4', '_themename-_pluginname' ), 26 | 'insert_into_item' => esc_html_x( 'Insert into portfolio item', 'Overrides the “Insert into post”/”Insert into page” phrase (used when inserting media into a post). Added in 4.4', '_themename-_pluginname' ), 27 | 'uploaded_to_this_item' => esc_html_x( 'Uploaded to this portfolio item', 'Overrides the “Uploaded to this post”/”Uploaded to this page” phrase (used when viewing media attached to a post). Added in 4.4', '_themename-_pluginname' ), 28 | 'filter_items_list' => esc_html_x( 'Filter portfolio items list', 'Screen reader text for the filter links heading on the post type listing screen. Default “Filter posts list”/”Filter pages list”. Added in 4.4', '_themename-_pluginname' ), 29 | 'items_list_navigation' => esc_html_x( 'Portfolio items list navigation', 'Screen reader text for the pagination heading on the post type listing screen. Default “Posts list navigation”/”Pages list navigation”. Added in 4.4', '_themename-_pluginname' ), 30 | 'items_list' => esc_html_x( 'Portfolio items list', 'Screen reader text for the items list heading on the post type listing screen. Default “Posts list”/”Pages list”. Added in 4.4', '_themename-_pluginname' ), 31 | ); 32 | 33 | $args = array( 34 | 'labels' => $labels, 35 | 'public' => true, 36 | 'has_archive' => true, 37 | 'menu_icon' => 'dashicons-format-gallery', 38 | 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments'), 39 | 'rewrite' => array('slug' => 'portfolio') 40 | ); 41 | register_post_type('_themename_portfolio', $args); 42 | } 43 | 44 | add_action('init', '_themename__pluginname_setup_post_type'); --------------------------------------------------------------------------------