├── .gitignore ├── README.md ├── mu-plugins ├── cmb2-post-search-field │ ├── .gitignore │ ├── README.md │ └── cmb2_post_search_field.php ├── cmb2 │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── bootstrap.php │ ├── css │ │ ├── cmb2.css │ │ └── cmb2.min.css │ ├── example-functions.php │ ├── images │ │ ├── ico-delete.png │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ └── ui-icons_cd0a0a_256x240.png │ ├── includes │ │ ├── CMB2.php │ │ ├── CMB2_Ajax.php │ │ ├── CMB2_Boxes.php │ │ ├── CMB2_Field.php │ │ ├── CMB2_Options.php │ │ ├── CMB2_Sanitize.php │ │ ├── CMB2_Show_Filters.php │ │ ├── CMB2_Types.php │ │ ├── CMB2_Utils.php │ │ ├── CMB2_hookup.php │ │ └── helper-functions.php │ ├── init.php │ ├── js │ │ ├── cmb2.js │ │ ├── cmb2.min.js │ │ └── jquery-ui-timepicker-addon.min.js │ ├── languages │ │ ├── cmb2-ach.po │ │ ├── cmb2-af.po │ │ ├── cmb2-ar.po │ │ ├── cmb2-az.po │ │ ├── cmb2-be_BY.po │ │ ├── cmb2-bg_BG.po │ │ ├── cmb2-bn_BD.po │ │ ├── cmb2-br.po │ │ ├── cmb2-bs_BA.po │ │ ├── cmb2-ca.po │ │ ├── cmb2-co.po │ │ ├── cmb2-cs_CZ.po │ │ ├── cmb2-cy.po │ │ ├── cmb2-da_DK.po │ │ ├── cmb2-de_AT.po │ │ ├── cmb2-de_DE.po │ │ ├── cmb2-el.po │ │ ├── cmb2-en@pirate.po │ │ ├── cmb2-en_GB.po │ │ ├── cmb2-en_US.mo │ │ ├── cmb2-en_US.po │ │ ├── cmb2-eo.po │ │ ├── cmb2-es_AR.po │ │ ├── cmb2-es_CL.po │ │ ├── cmb2-es_ES.mo │ │ ├── cmb2-es_ES.po │ │ ├── cmb2-es_MX.mo │ │ ├── cmb2-es_MX.po │ │ ├── cmb2-es_PE.po │ │ ├── cmb2-es_VE.po │ │ ├── cmb2-et.po │ │ ├── cmb2-eu.po │ │ ├── cmb2-fa.po │ │ ├── cmb2-fa_IR.po │ │ ├── cmb2-fi.mo │ │ ├── cmb2-fi.po │ │ ├── cmb2-fo.po │ │ ├── cmb2-fr_FR.mo │ │ ├── cmb2-fr_FR.po │ │ ├── cmb2-ga.po │ │ ├── cmb2-gl_ES.po │ │ ├── cmb2-gu_IN.po │ │ ├── cmb2-he_IL.po │ │ ├── cmb2-hi_IN.po │ │ ├── cmb2-hr.po │ │ ├── cmb2-hu_HU.po │ │ ├── cmb2-hy.po │ │ ├── cmb2-id.po │ │ ├── cmb2-id_ID.mo │ │ ├── cmb2-id_ID.po │ │ ├── cmb2-is_IS.po │ │ ├── cmb2-it_IT.po │ │ ├── cmb2-ja.po │ │ ├── cmb2-jv.po │ │ ├── cmb2-ka.po │ │ ├── cmb2-kk.po │ │ ├── cmb2-km.po │ │ ├── cmb2-ko_KR.po │ │ ├── cmb2-ku.po │ │ ├── cmb2-ky.po │ │ ├── cmb2-lt_LT.po │ │ ├── cmb2-lv.po │ │ ├── cmb2-mg.po │ │ ├── cmb2-mk_MK.po │ │ ├── cmb2-mn.po │ │ ├── cmb2-my_MM.po │ │ ├── cmb2-nb_NO.po │ │ ├── cmb2-ne_NP.po │ │ ├── cmb2-nl_NL.po │ │ ├── cmb2-nn_NO.po │ │ ├── cmb2-oc.po │ │ ├── cmb2-pap.po │ │ ├── cmb2-pl_PL.mo │ │ ├── cmb2-pl_PL.po │ │ ├── cmb2-pt_BR.mo │ │ ├── cmb2-pt_BR.po │ │ ├── cmb2-pt_PT.po │ │ ├── cmb2-ro_RO.po │ │ ├── cmb2-ru_RU.mo │ │ ├── cmb2-ru_RU.po │ │ ├── cmb2-sah.po │ │ ├── cmb2-si_LK.po │ │ ├── cmb2-sk_SK.po │ │ ├── cmb2-sl_SI.po │ │ ├── cmb2-sq.po │ │ ├── cmb2-sr_RS.po │ │ ├── cmb2-su.po │ │ ├── cmb2-sv_SE.mo │ │ ├── cmb2-sv_SE.po │ │ ├── cmb2-sw.po │ │ ├── cmb2-ta_LK.po │ │ ├── cmb2-te.po │ │ ├── cmb2-th.po │ │ ├── cmb2-tk_TM.po │ │ ├── cmb2-tr_TR.po │ │ ├── cmb2-ug.po │ │ ├── cmb2-uk.po │ │ ├── cmb2-ur_PK.po │ │ ├── cmb2-uz.po │ │ ├── cmb2-vi.po │ │ ├── cmb2-zh_CN.GB2312.po │ │ ├── cmb2-zh_CN.po │ │ ├── cmb2-zh_HK.po │ │ ├── cmb2-zh_TW.po │ │ ├── cmb2.mo │ │ └── cmb2.pot │ └── readme.txt ├── include-cmb-for-project.php └── include-cmb2-post-search-field.php ├── plugins ├── akismet │ ├── _inc │ │ ├── akismet.css │ │ ├── akismet.js │ │ ├── form.js │ │ └── img │ │ │ └── logo-full-2x.png │ ├── akismet.php │ ├── class.akismet-admin.php │ ├── class.akismet-widget.php │ ├── class.akismet.php │ ├── readme.txt │ ├── views │ │ ├── config.php │ │ ├── get.php │ │ ├── notice.php │ │ ├── start.php │ │ ├── stats.php │ │ └── strict.php │ └── wrapper.php └── books-cpt │ ├── README.md │ ├── books-cpt.php │ ├── cpt.php │ ├── custom-fields.php │ ├── readme.txt │ ├── submission-form-shortcode.php │ ├── taxonomy.php │ └── template-filters.php └── themes ├── twentyfourteen-child-books ├── content-homepage.php ├── footer.php ├── front-page.php ├── functions.php ├── includes │ ├── cmb-fields.php │ ├── custom-cmb-field-types.php │ └── theme-options-cmb.php ├── screenshot.png └── style.css └── twentyfourteen ├── 404.php ├── archive.php ├── author.php ├── category.php ├── comments.php ├── content-aside.php ├── content-audio.php ├── content-featured-post.php ├── content-gallery.php ├── content-image.php ├── content-link.php ├── content-none.php ├── content-page.php ├── content-quote.php ├── content-video.php ├── content.php ├── css ├── editor-style.css └── ie.css ├── featured-content.php ├── footer.php ├── functions.php ├── genericons ├── COPYING.txt ├── Genericons-Regular.otf ├── LICENSE.txt ├── README.txt ├── font │ ├── genericons-regular-webfont.eot │ ├── genericons-regular-webfont.svg │ ├── genericons-regular-webfont.ttf │ └── genericons-regular-webfont.woff └── genericons.css ├── header.php ├── image.php ├── images ├── pattern-dark.svg └── pattern-light.svg ├── inc ├── back-compat.php ├── custom-header.php ├── customizer.php ├── featured-content.php ├── template-tags.php └── widgets.php ├── js ├── customizer.js ├── featured-content-admin.js ├── functions.js ├── html5.js ├── keyboard-image-navigation.js └── slider.js ├── languages └── twentyfourteen.pot ├── page-templates ├── contributors.php └── full-width.php ├── page.php ├── rtl.css ├── screenshot.png ├── search.php ├── sidebar-content.php ├── sidebar-footer.php ├── sidebar.php ├── single.php ├── style.css ├── tag.php └── taxonomy-post_format.php /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### WordPress ### 4 | *.log 5 | .htaccess 6 | sitemap.xml 7 | sitemap.xml.gz 8 | wp-config.php 9 | advanced-cache.php 10 | backup-db/ 11 | backups/ 12 | blogs.dir/ 13 | cache/ 14 | upgrade/ 15 | uploads/ 16 | wp-cache-config.php 17 | *index.php 18 | 19 | 20 | ### OSX ### 21 | .DS_Store 22 | .AppleDouble 23 | .LSOverride 24 | 25 | # Icon must end with two \r 26 | Icon 27 | 28 | 29 | # Thumbnails 30 | ._* 31 | 32 | # Files that might appear in the root of a volume 33 | .DocumentRevisions-V100 34 | .fseventsd 35 | .Spotlight-V100 36 | .TemporaryItems 37 | .Trashes 38 | .VolumeIcon.icns 39 | 40 | # Directories potentially created on remote AFP share 41 | .AppleDB 42 | .AppleDesktop 43 | Network Trash Folder 44 | Temporary Items 45 | .apdisk 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CMB2 WPSessions Demo 2 | ==== 3 | 4 | A WPSessions demo/walk-through for using CMB2 to power your project's fields. This repo is to demonstrate how to get up and running with CMB2 and will be used for my [WPSessions session](http://wpsessions.com/sessions/custom-meta-and-settings-with-cmb2/). 5 | 6 | To follow demonstration, [check out the tags](https://github.com/jtsternberg/CMB2-WPSessions-Demo/releases) in order. 7 | -------------------------------------------------------------------------------- /mu-plugins/cmb2-post-search-field/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by http://www.gitignore.io 2 | 3 | ### OSX ### 4 | .DS_Store 5 | .AppleDouble 6 | .LSOverride 7 | 8 | # Icon must end with two \r 9 | Icon 10 | 11 | 12 | # Thumbnails 13 | ._* 14 | 15 | # Files that might appear on external disk 16 | .Spotlight-V100 17 | .Trashes 18 | 19 | # Directories potentially created on remote AFP share 20 | .AppleDB 21 | .AppleDesktop 22 | Network Trash Folder 23 | Temporary Items 24 | .apdisk 25 | 26 | 27 | ### Node ### 28 | # Logs 29 | logs 30 | *.log 31 | 32 | # Runtime data 33 | pids 34 | *.pid 35 | *.seed 36 | 37 | # Directory for instrumented libs generated by jscoverage/JSCover 38 | lib-cov 39 | 40 | # Coverage directory used by tools like istanbul 41 | coverage 42 | 43 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 44 | .grunt 45 | 46 | # Compiled binary addons (http://nodejs.org/api/addons.html) 47 | build/Release 48 | 49 | # Dependency directory 50 | # Deployed apps should consider commenting this line out: 51 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 52 | node_modules 53 | 54 | # Sass Cache 55 | *.sass-cache 56 | 57 | dandelion.yml 58 | -------------------------------------------------------------------------------- /mu-plugins/cmb2-post-search-field/README.md: -------------------------------------------------------------------------------- 1 | CMB2 Post Search field 2 | ====================== 3 | 4 | Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs 5 | 6 | Adds a new field type, `post_search_text` that adds a quick post search dialog for saving post IDs to a text input. 7 | 8 | If you're looking for a more general way to attach posts (or other custom post types) with a drag and drop interface, you might consider [CMB2 Attached Posts Field](https://github.com/WebDevStudios/cmb2-attached-posts) instead. 9 | -------------------------------------------------------------------------------- /mu-plugins/cmb2-post-search-field/cmb2_post_search_field.php: -------------------------------------------------------------------------------- 1 | args( 'select_type' ); 14 | 15 | echo $field_type->input( array( 16 | 'data-posttype' => $field->args( 'post_type' ), 17 | 'data-selecttype' => 'radio' == $select_type ? 'radio' : 'checkbox', 18 | ) ); 19 | } 20 | add_action( 'cmb2_render_post_search_text', 'cmb2_post_search_render_field', 10, 5 ); 21 | 22 | function cmb2_post_search_render_js( $cmb_id, $object_id, $object_type, $cmb ) { 23 | static $rendered; 24 | 25 | if ( $rendered ) { 26 | return; 27 | } 28 | 29 | $fields = $cmb->prop( 'fields' ); 30 | 31 | if ( ! is_array( $fields ) ) { 32 | return; 33 | } 34 | 35 | $has_post_search_field = false; 36 | foreach ( $fields as $field ) { 37 | if ( 'post_search_text' == $field['type'] ) { 38 | $has_post_search_field = true; 39 | break; 40 | } 41 | } 42 | 43 | if ( ! $has_post_search_field ) { 44 | return; 45 | } 46 | 47 | // JS needed for modal 48 | // wp_enqueue_media(); 49 | wp_enqueue_script( 'jquery' ); 50 | wp_enqueue_script( 'wp-backbone' ); 51 | 52 | if ( ! is_admin() ) { 53 | // Will need custom styling! 54 | // @todo add styles for front-end 55 | require_once( ABSPATH . 'wp-admin/includes/template.php' ); 56 | add_action( 'wp_footer', 'find_posts_div' ); 57 | } 58 | 59 | // markup needed for modal 60 | add_action( 'admin_footer', 'find_posts_div' ); 61 | 62 | $error = __( 'An error has occurred. Please reload the page and try again.' ); 63 | $find = __( 'Find Posts or Pages' ); 64 | 65 | // @TODO this should really be in its own JS file. 66 | ?> 67 | 221 | set( 'post_type', esc_attr( $_POST['post_search_cpt'] ) ); 233 | } 234 | 235 | /** 236 | * Check to see if we have a post type set and, if so, add the 237 | * pre_get_posts action to set the queried post type 238 | */ 239 | function cmb2_post_search_wp_ajax_find_posts() { 240 | if ( 241 | defined( 'DOING_AJAX' ) 242 | && DOING_AJAX 243 | && isset( $_POST['cmb2_post_search'], $_POST['action'], $_POST['post_search_cpt'] ) 244 | && 'find_posts' == $_POST['action'] 245 | && ! empty( $_POST['post_search_cpt'] ) 246 | ) { 247 | add_action( 'pre_get_posts', 'cmb2_post_search_set_post_type' ); 248 | } 249 | } 250 | add_action( 'admin_init', 'cmb2_post_search_wp_ajax_find_posts' ); 251 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to CMB2 2 | 3 | Thank you for your interest in contributing back to CMB2. Please help us review your issues and/or merge your pull requests by following the below guidelines. 4 | 5 | #### NOTE: The issues section is for bug reports and feature requests only. 6 | _Support is not offered for this library, and the likelihood that the maintainers will respond is very low. If you need help, please use [stackoverflow](http://stackoverflow.com/search?q=cmb), or the [wordpress.org plugin forums](http://wordpress.org/support/plugin/cmb2)._ 7 | 8 | Before reporting a bug 9 | --- 10 | 1. Search [issues](https://github.com/WebDevStudios/CMB2/issues) to see if the issue has been previously reported. 11 | 2. Install the trunk version of CMB2 and test there. 12 | 13 | 14 | How to report a bug 15 | --- 16 | 1. Specify the version number for both WordPress and CMB2. 17 | 3. Describe the problem in detail. Explain what happened, and what you expected would happen. 18 | 4. Provide a small test-case and a link to a [gist](https://gist.github.com/) containing your entire metabox registration code. 19 | 5. If helpful, include a screenshot. Annotate the screenshot for clarity. 20 | 21 | 22 | How to contribute to CMB2 23 | --- 24 | All contributions welcome. If you would like to submit a pull request, please follow the steps below. 25 | 26 | 1. Make sure you have a GitHub account. 27 | 2. Fork the repository on GitHub. 28 | 3. **Check out the trunk version of CMB2.** If you submit to the master branch, the PR will be closed with a link back to this document. 29 | 4. **Verify your issue still exists in the trunk branch.** 30 | 5. Make changes to your clone of the repository. 31 | 1. Please follow the [WordPress code standards](https://make.wordpress.org/core/handbook/coding-standards). 32 | 2. If possible, and if applicable, please also add/update unit tests for your changes. 33 | 3. Please add documentation to any new functions, methods, actions and filters. 34 | 4. When committing, reference your issue (if present) and include a note about the fix. 35 | 6. [Submit a pull request](https://help.github.com/articles/creating-a-pull-request/). 36 | 37 | **Note:** You may gain more ground and avoid unecessary effort if you first open an issue with the proposed changes, but this step is not necessary. 38 | 39 | Additional Resources 40 | --- 41 | 42 | * [CMB2 Documentation Wiki](https://github.com/WebDevStudios/CMB2/wiki) 43 | * [CMB2 Snippet Library](https://github.com/WebDevStudios/CMB2-Snippet-Library) 44 | * [CMB2 API Documentation](http://cmb2.io/api/) 45 | * [General GitHub Documentation](http://help.github.com/) 46 | * [GitHub Pull Request documentation](http://help.github.com/send-pull-requests/) 47 | * [PHPUnit Tests Guide](http://phpunit.de/manual/current/en/writing-tests-for-phpunit.html) -------------------------------------------------------------------------------- /mu-plugins/cmb2/bootstrap.php: -------------------------------------------------------------------------------- 1 | prop( 'hookup' ) ) { 41 | $hookup = new CMB2_hookup( $cmb ); 42 | } 43 | } 44 | 45 | /** 46 | * Fires after CMB2 initiation process has been completed 47 | */ 48 | do_action( 'cmb2_after_init' ); 49 | 50 | // End. That's it, folks! // 51 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ico-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ico-delete.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /mu-plugins/cmb2/includes/CMB2_Ajax.php: -------------------------------------------------------------------------------- 1 | ' . __( 'Please Try Again', 'cmb2' ) . '

' ); 41 | } 42 | 43 | // Set width of embed 44 | $embed_width = isset( $_REQUEST['oembed_width'] ) && intval( $_REQUEST['oembed_width'] ) < 640 ? intval( $_REQUEST['oembed_width'] ) : '640'; 45 | 46 | // Set url 47 | $oembed_url = esc_url( $oembed_string ); 48 | 49 | // Set args 50 | $embed_args = array( 'width' => $embed_width ); 51 | 52 | $this->ajax_update = true; 53 | 54 | // Get embed code (or fallback link) 55 | $html = $this->get_oembed( array( 56 | 'url' => $oembed_url, 57 | 'object_id' => $_REQUEST['object_id'], 58 | 'object_type' => isset( $_REQUEST['object_type'] ) ? $_REQUEST['object_type'] : 'post', 59 | 'oembed_args' => $embed_args, 60 | 'field_id' => $_REQUEST['field_id'], 61 | ) ); 62 | 63 | wp_send_json_success( $html ); 64 | } 65 | 66 | /** 67 | * Retrieves oEmbed from url/object ID 68 | * @since 0.9.5 69 | * @param array $args Arguments for method 70 | * @return string html markup with embed or fallback 71 | */ 72 | public function get_oembed( $args ) { 73 | 74 | global $wp_embed; 75 | 76 | $oembed_url = esc_url( $args['url'] ); 77 | 78 | // Sanitize object_id 79 | $this->object_id = is_numeric( $args['object_id'] ) ? absint( $args['object_id'] ) : sanitize_text_field( $args['object_id'] ); 80 | 81 | $args = wp_parse_args( $args, array( 82 | 'object_type' => 'post', 83 | 'oembed_args' => $this->embed_args, 84 | 'field_id' => false, 85 | 'cache_key' => false, 86 | ) ); 87 | 88 | $this->embed_args =& $args; 89 | 90 | 91 | /** 92 | * Set the post_ID so oEmbed won't fail 93 | * wp-includes/class-wp-embed.php, WP_Embed::shortcode() 94 | */ 95 | $wp_embed->post_ID = $this->object_id; 96 | 97 | // Special scenario if NOT a post object 98 | if ( isset( $args['object_type'] ) && 'post' != $args['object_type'] ) { 99 | 100 | if ( 'options-page' == $args['object_type'] ) { 101 | 102 | // Bogus id to pass some numeric checks. Issue with a VERY large WP install? 103 | $wp_embed->post_ID = 1987645321; 104 | 105 | // Use our own cache key to correspond to this field (vs one cache key per url) 106 | $args['cache_key'] = $args['field_id'] . '_cache'; 107 | } 108 | 109 | // Ok, we need to hijack the oembed cache system 110 | $this->hijack = true; 111 | $this->object_type = $args['object_type']; 112 | 113 | // Gets ombed cache from our object's meta (vs postmeta) 114 | add_filter( 'get_post_metadata', array( $this, 'hijack_oembed_cache_get' ), 10, 3 ); 115 | 116 | // Sets ombed cache in our object's meta (vs postmeta) 117 | add_filter( 'update_post_metadata', array( $this, 'hijack_oembed_cache_set' ), 10, 4 ); 118 | 119 | } 120 | 121 | $embed_args = ''; 122 | 123 | foreach ( $args['oembed_args'] as $key => $val ) { 124 | $embed_args .= " $key=\"$val\""; 125 | } 126 | 127 | // Ping WordPress for an embed 128 | $check_embed = $wp_embed->run_shortcode( '[embed' . $embed_args . ']' . $oembed_url . '[/embed]' ); 129 | 130 | // Fallback that WordPress creates when no oEmbed was found 131 | $fallback = $wp_embed->maybe_make_link( $oembed_url ); 132 | 133 | // Send back our embed 134 | if ( $check_embed && $check_embed != $fallback ) { 135 | return '
' . $check_embed . '

' . __( 'Remove Embed', 'cmb2' ) . '

'; 136 | } 137 | 138 | // Otherwise, send back error info that no oEmbeds were found 139 | return '

' . sprintf( __( 'No oEmbed Results Found for %s. View more info at', 'cmb2' ), $fallback ) . ' codex.wordpress.org/Embeds.

'; 140 | 141 | } 142 | 143 | /** 144 | * Hijacks retrieving of cached oEmbed. 145 | * Returns cached data from relevant object metadata (vs postmeta) 146 | * 147 | * @since 0.9.5 148 | * @param boolean $check Whether to retrieve postmeta or override 149 | * @param int $object_id Object ID 150 | * @param string $meta_key Object metakey 151 | * @return mixed Object's oEmbed cached data 152 | */ 153 | public function hijack_oembed_cache_get( $check, $object_id, $meta_key ) { 154 | 155 | if ( ! $this->hijack || ( $this->object_id != $object_id && 1987645321 !== $object_id ) ) { 156 | return $check; 157 | } 158 | 159 | if ( $this->ajax_update ) { 160 | return false; 161 | } 162 | 163 | // Get cached data 164 | return ( 'options-page' === $this->object_type ) 165 | ? cmb2_options( $this->object_id )->get( $this->embed_args['cache_key'] ) 166 | : get_metadata( $this->object_type, $this->object_id, $meta_key, true ); 167 | 168 | } 169 | 170 | /** 171 | * Hijacks saving of cached oEmbed. 172 | * Saves cached data to relevant object metadata (vs postmeta) 173 | * 174 | * @since 0.9.5 175 | * @param boolean $check Whether to continue setting postmeta 176 | * @param int $object_id Object ID to get postmeta from 177 | * @param string $meta_key Postmeta's key 178 | * @param mixed $meta_value Value of the postmeta to be saved 179 | * @return boolean Whether to continue setting 180 | */ 181 | public function hijack_oembed_cache_set( $check, $object_id, $meta_key, $meta_value ) { 182 | 183 | if ( ! $this->hijack || ( $this->object_id != $object_id && 1987645321 !== $object_id ) ) { 184 | return $check; 185 | } 186 | 187 | $this->oembed_cache_set( $meta_key, $meta_value ); 188 | 189 | // Anything other than `null` to cancel saving to postmeta 190 | return true; 191 | } 192 | 193 | /** 194 | * Saves the cached oEmbed value to relevant object metadata (vs postmeta) 195 | * 196 | * @since 1.3.0 197 | * @param string $meta_key Postmeta's key 198 | * @param mixed $meta_value Value of the postmeta to be saved 199 | */ 200 | public function oembed_cache_set( $meta_key, $meta_value ) { 201 | 202 | // Cache the result to our metadata 203 | return ( 'options-page' !== $this->object_type ) 204 | ? update_metadata( $this->object_type, $this->object_id, $meta_key, $meta_value ) 205 | : cmb2_options( $this->object_id )->update( $this->embed_args['cache_key'], $meta_value, true ); 206 | } 207 | 208 | } 209 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/includes/CMB2_Boxes.php: -------------------------------------------------------------------------------- 1 | cmb_id ] = $cmb_instance; 27 | } 28 | 29 | /** 30 | * Remove a CMB2 instance object to the registry 31 | * @since 1.X.X 32 | * @param string $cmb_id A CMB2 instance id 33 | */ 34 | public static function remove( $cmb_id ) { 35 | if ( array_key_exists( $cmb_id, self::$cmb2_instances ) ) { 36 | unset( self::$cmb2_instances[ $cmb_id ] ); 37 | } 38 | } 39 | 40 | /** 41 | * Retrieve a CMB2 instance by cmb id 42 | * @since 1.X.X 43 | * @param string $cmb_id A CMB2 instance id 44 | * 45 | * @return mixed False or CMB2 object instance 46 | */ 47 | public static function get( $cmb_id ) { 48 | if ( empty( self::$cmb2_instances ) || empty( self::$cmb2_instances[ $cmb_id ] ) ) { 49 | return false; 50 | } 51 | 52 | return self::$cmb2_instances[ $cmb_id ]; 53 | } 54 | 55 | /** 56 | * Retrieve all CMB2 instances registered 57 | * @since 1.X.X 58 | * @return array Array of all registered metaboxes 59 | */ 60 | public static function get_all() { 61 | return self::$cmb2_instances; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/includes/CMB2_Options.php: -------------------------------------------------------------------------------- 1 | key = ! empty( $option_key ) ? $option_key : ''; 65 | } 66 | 67 | /** 68 | * Delete the option from the db 69 | * @since 2.0.0 70 | * @return bool Delete success or failure 71 | */ 72 | public function delete_option() { 73 | $deleted = $this->key ? delete_option( $this->key ) : true; 74 | $this->options = $deleted ? array() : $this->options; 75 | return $this->options; 76 | } 77 | 78 | /** 79 | * Removes an option from an option array 80 | * @since 1.0.1 81 | * @param string $field_id Option array field key 82 | * @return array Modified options 83 | */ 84 | public function remove( $field_id, $resave = false ) { 85 | 86 | $this->get_options(); 87 | 88 | if ( isset( $this->options[ $field_id ] ) ) { 89 | unset( $this->options[ $field_id ] ); 90 | } 91 | 92 | if ( $resave ) { 93 | $this->set(); 94 | } 95 | 96 | return $this->options; 97 | } 98 | 99 | /** 100 | * Retrieves an option from an option array 101 | * @since 1.0.1 102 | * @param string $field_id Option array field key 103 | * @param mixed $default Fallback value for the option 104 | * @return array Requested field or default 105 | */ 106 | public function get( $field_id, $default = false ) { 107 | $opts = $this->get_options(); 108 | 109 | if ( 'all' == $field_id ) { 110 | return $opts; 111 | } elseif ( array_key_exists( $field_id, $opts ) ) { 112 | return false !== $opts[ $field_id ] ? $opts[ $field_id ] : $default; 113 | } 114 | 115 | return $default; 116 | } 117 | 118 | /** 119 | * Updates Option data 120 | * @since 1.0.1 121 | * @param string $field_id Option array field key 122 | * @param mixed $value Value to update data with 123 | * @param bool $resave Whether to re-save the data 124 | * @param bool $single Whether data should not be an array 125 | * @return boolean Return status of update 126 | */ 127 | public function update( $field_id, $value = '', $resave = false, $single = true ) { 128 | $this->get_options(); 129 | 130 | if ( true !== $field_id ) { 131 | 132 | if ( ! $single ) { 133 | // If multiple, add to array 134 | $this->options[ $field_id ][] = $value; 135 | } else { 136 | $this->options[ $field_id ] = $value; 137 | } 138 | 139 | } 140 | 141 | if ( $resave || true === $field_id ) { 142 | return $this->set(); 143 | } 144 | 145 | return true; 146 | } 147 | 148 | /** 149 | * Saves the option array 150 | * Needs to be run after finished using remove/update_option 151 | * @uses apply_filters() Calls 'cmb2_override_option_save_{$this->key}' hook 152 | * to allow overwriting the option value to be stored. 153 | * 154 | * @since 1.0.1 155 | * @param array $options Optional options to override 156 | * @return bool Success/Failure 157 | */ 158 | public function set( $options = array() ) { 159 | $this->options = ! empty( $options ) || empty( $options ) && empty( $this->key ) 160 | ? $options 161 | : $this->options; 162 | 163 | if ( empty( $this->key ) ) { 164 | return false; 165 | } 166 | 167 | $test_save = apply_filters( "cmb2_override_option_save_{$this->key}", 'cmb2_no_override_option_save', $this->options, $this ); 168 | 169 | if ( 'cmb2_no_override_option_save' !== $test_save ) { 170 | return $test_save; 171 | } 172 | 173 | // If no override, update the option 174 | return update_option( $this->key, $this->options ); 175 | } 176 | 177 | /** 178 | * Retrieve option value based on name of option. 179 | * @uses apply_filters() Calls 'cmb2_override_option_get_{$this->key}' hook to allow 180 | * overwriting the option value to be retrieved. 181 | * 182 | * @since 1.0.1 183 | * @param mixed $default Optional. Default value to return if the option does not exist. 184 | * @return mixed Value set for the option. 185 | */ 186 | public function get_options( $default = null ) { 187 | if ( empty( $this->options ) && ! empty( $this->key ) ) { 188 | 189 | $test_get = apply_filters( "cmb2_override_option_get_{$this->key}", 'cmb2_no_override_option_get', $default, $this ); 190 | 191 | if ( 'cmb2_no_override_option_get' !== $test_get ) { 192 | $this->options = $test_get; 193 | } else { 194 | // If no override, get the option 195 | $this->options = get_option( $this->key, $default ); 196 | } 197 | } 198 | 199 | return (array) $this->options; 200 | } 201 | 202 | } 203 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/includes/CMB2_Show_Filters.php: -------------------------------------------------------------------------------- 1 | object_id() : @get_the_id(); 85 | 86 | if ( ! $object_id ) { 87 | return false; 88 | } 89 | 90 | // If current page id is in the included array, display the metabox 91 | return in_array( $object_id, (array) self::get_show_on_value( $meta_box_args ) ); 92 | } 93 | 94 | /** 95 | * Add metaboxes for an specific Page Template 96 | * @since 1.0.0 97 | * @param bool $display To display or not 98 | * @param array $meta_box_args Metabox config array 99 | * @return bool Whether to display this metabox on the current page. 100 | */ 101 | public static function check_page_template( $display, $meta_box_args, $cmb ) { 102 | 103 | $key = self::get_show_on_key( $meta_box_args ); 104 | if ( ! $key || 'page-template' !== $key ) { 105 | return $display; 106 | } 107 | 108 | $object_id = $cmb->object_id(); 109 | 110 | if ( ! $object_id || 'post' !== $cmb->object_type() ) { 111 | return false; 112 | } 113 | 114 | // Get current template 115 | $current_template = get_post_meta( $object_id, '_wp_page_template', true ); 116 | 117 | // See if there's a match 118 | if ( $current_template && in_array( $current_template, (array) self::get_show_on_value( $meta_box_args ) ) ) { 119 | return true; 120 | } 121 | 122 | return false; 123 | } 124 | 125 | /** 126 | * Only show options-page metaboxes on their options page (but only enforce on the admin side) 127 | * @since 1.0.0 128 | * @param bool $display To display or not 129 | * @param array $meta_box_args Metabox config array 130 | * @return bool Whether to display this metabox on the current page. 131 | */ 132 | public static function check_admin_page( $display, $meta_box_args ) { 133 | 134 | $key = self::get_show_on_key( $meta_box_args ); 135 | // check if this is a 'options-page' metabox 136 | if ( ! $key || 'options-page' !== $key ) { 137 | return $display; 138 | } 139 | 140 | // Enforce 'show_on' filter in the admin 141 | if ( is_admin() ) { 142 | 143 | // If there is no 'page' query var, our filter isn't applicable 144 | if ( ! isset( $_GET['page'] ) ) { 145 | return $display; 146 | } 147 | 148 | $show_on = self::get_show_on_value( $meta_box_args ); 149 | 150 | if ( empty( $show_on ) ) { 151 | return false; 152 | } 153 | 154 | if ( is_array( $show_on ) ) { 155 | foreach ( $show_on as $page ) { 156 | if ( $_GET['page'] == $page ) { 157 | return true; 158 | } 159 | } 160 | } else { 161 | if ( $_GET['page'] == $show_on ) { 162 | return true; 163 | } 164 | } 165 | 166 | return false; 167 | 168 | } 169 | 170 | // Allow options-page metaboxes to be displayed anywhere on the front-end 171 | return true; 172 | } 173 | 174 | } 175 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/includes/CMB2_Utils.php: -------------------------------------------------------------------------------- 1 | get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid LIKE '%%%s%%' LIMIT 1;", $img_url ) ); 40 | 41 | // If we found an attachement ID, return it 42 | if ( ! empty( $attachment ) && is_array( $attachment ) ) { 43 | return $attachment[0]; 44 | } 45 | 46 | // No luck 47 | return false; 48 | } 49 | 50 | /** 51 | * Utility method that returns time string offset by timezone 52 | * @since 1.0.0 53 | * @param string $tzstring Time string 54 | * @return string Offset time string 55 | */ 56 | public function timezone_offset( $tzstring ) { 57 | if ( ! empty( $tzstring ) && is_string( $tzstring ) ) { 58 | if ( 'UTC' === substr( $tzstring, 0, 3 ) ) { 59 | $tzstring = str_replace( array( ':15', ':30', ':45' ), array( '.25', '.5', '.75' ), $tzstring ); 60 | return intval( floatval( substr( $tzstring, 3 ) ) * HOUR_IN_SECONDS ); 61 | } 62 | 63 | $date_time_zone_selected = new DateTimeZone( $tzstring ); 64 | $tz_offset = timezone_offset_get( $date_time_zone_selected, date_create() ); 65 | 66 | return $tz_offset; 67 | } 68 | 69 | return 0; 70 | } 71 | 72 | /** 73 | * Utility method that returns a timezone string representing the default timezone for the site. 74 | * 75 | * Roughly copied from WordPress, as get_option('timezone_string') will return 76 | * an empty string if no value has been set on the options page. 77 | * A timezone string is required by the wp_timezone_choice() used by the 78 | * select_timezone field. 79 | * 80 | * @since 1.0.0 81 | * @return string Timezone string 82 | */ 83 | public function timezone_string() { 84 | $current_offset = get_option( 'gmt_offset' ); 85 | $tzstring = get_option( 'timezone_string' ); 86 | 87 | if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists 88 | if ( 0 == $current_offset ) { 89 | $tzstring = 'UTC+0'; 90 | } elseif ( $current_offset < 0 ) { 91 | $tzstring = 'UTC' . $current_offset; 92 | } else { 93 | $tzstring = 'UTC+' . $current_offset; 94 | } 95 | } 96 | 97 | return $tzstring; 98 | } 99 | 100 | /** 101 | * Returns a timestamp, first checking if value already is a timestamp. 102 | * @since 2.0.0 103 | * @param string|int $string Possible timestamp string 104 | * @return int Time stamp 105 | */ 106 | public function make_valid_time_stamp( $string ) { 107 | if ( ! $string ) { 108 | return 0; 109 | } 110 | 111 | return $this->is_valid_time_stamp( $string ) 112 | ? (int) $string : 113 | strtotime( $string ); 114 | } 115 | 116 | /** 117 | * Determine if a value is a valid timestamp 118 | * @since 2.0.0 119 | * @param mixed $timestamp Value to check 120 | * @return boolean Whether value is a valid timestamp 121 | */ 122 | public function is_valid_time_stamp( $timestamp ) { 123 | return (string) (int) $timestamp === (string) $timestamp 124 | && $timestamp <= PHP_INT_MAX 125 | && $timestamp >= ~PHP_INT_MAX; 126 | } 127 | 128 | /** 129 | * Checks if a value is 'empty'. Still accepts 0. 130 | * @since 2.0.0 131 | * @param mixed $value Value to check 132 | * @return bool True or false 133 | */ 134 | public function isempty( $value ) { 135 | return null === $value || '' === $value || false === $value; 136 | } 137 | 138 | /** 139 | * Insert a single array item inside another array at a set position 140 | * @since 2.0.2 141 | * @param array &$array Array to modify. Is passed by reference, and no return is needed. 142 | * @param array $new New array to insert 143 | * @param int $position Position in the main array to insert the new array 144 | */ 145 | public function array_insert( &$array, $new, $position ) { 146 | $before = array_slice( $array, 0, $position - 1 ); 147 | $after = array_diff_key( $array, $before ); 148 | $array = array_merge( $before, $new, $after ); 149 | } 150 | 151 | /** 152 | * Defines the url which is used to load local resources. 153 | * This may need to be filtered for local Window installations. 154 | * If resources do not load, please check the wiki for details. 155 | * @since 1.0.1 156 | * @return string URL to CMB2 resources 157 | */ 158 | public function url( $path = '' ) { 159 | if ( $this->url ) { 160 | return $this->url . $path; 161 | } 162 | 163 | if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) { 164 | // Windows 165 | $content_dir = str_replace( '/', DIRECTORY_SEPARATOR, WP_CONTENT_DIR ); 166 | $content_url = str_replace( $content_dir, WP_CONTENT_URL, cmb2_dir() ); 167 | $cmb2_url = str_replace( DIRECTORY_SEPARATOR, '/', $content_url ); 168 | 169 | } else { 170 | $cmb2_url = str_replace( 171 | array( WP_CONTENT_DIR, WP_PLUGIN_DIR ), 172 | array( WP_CONTENT_URL, WP_PLUGIN_URL ), 173 | cmb2_dir() 174 | ); 175 | } 176 | 177 | /** 178 | * Filter the CMB location url 179 | * 180 | * @param string $cmb2_url Currently registered url 181 | */ 182 | $this->url = trailingslashit( apply_filters( 'cmb2_meta_box_url', set_url_scheme( $cmb2_url ), CMB2_VERSION ) ); 183 | 184 | return $this->url . $path; 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/init.php: -------------------------------------------------------------------------------- 1 | l10ni18n(); 142 | 143 | // Include helper functions 144 | require_once 'includes/helper-functions.php'; 145 | 146 | // Now kick off the class autoloader 147 | spl_autoload_register( 'cmb2_autoload_classes' ); 148 | 149 | // Kick the whole thing off 150 | require_once 'bootstrap.php'; 151 | } 152 | 153 | /** 154 | * Registers CMB2 text domain path 155 | * @since 2.0.0 156 | */ 157 | public function l10ni18n() { 158 | $loaded = load_plugin_textdomain( 'cmb2', false, '/languages/' ); 159 | if ( ! $loaded ) { 160 | $loaded = load_muplugin_textdomain( 'cmb2', '/languages/' ); 161 | } 162 | if ( ! $loaded ) { 163 | $loaded = load_theme_textdomain( 'cmb2', '/languages/' ); 164 | } 165 | 166 | if ( ! $loaded ) { 167 | $locale = apply_filters( 'plugin_locale', get_locale(), 'cmb2' ); 168 | $mofile = dirname( __FILE__ ) . '/languages/cmb2-' . $locale . '.mo'; 169 | load_textdomain( 'cmb2', $mofile ); 170 | } 171 | } 172 | 173 | } 174 | 175 | // Make it so... 176 | CMB2_Bootstrap_206::initiate(); 177 | 178 | } 179 | -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-en_US.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-en_US.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-es_ES.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-es_ES.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-es_MX.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-es_MX.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-fi.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-fi.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-fr_FR.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-id_ID.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-id_ID.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-pl_PL.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-pl_PL.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-pt_BR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-pt_BR.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-ru_RU.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-ru_RU.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2-sv_SE.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2-sv_SE.mo -------------------------------------------------------------------------------- /mu-plugins/cmb2/languages/cmb2.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/mu-plugins/cmb2/languages/cmb2.mo -------------------------------------------------------------------------------- /mu-plugins/include-cmb-for-project.php: -------------------------------------------------------------------------------- 1 | x' ) 32 | .attr( 'commentid', thisCommentId[1] ) 33 | .attr( 'title', WPAkismet.strings['Remove this URL'] ) 34 | ); 35 | } 36 | }); 37 | $('.remove_url').live('click', function () { 38 | var thisId = $(this).attr('commentid'); 39 | var data = { 40 | action: 'comment_author_deurl', 41 | _wpnonce: WPAkismet.comment_author_url_nonce, 42 | id: thisId 43 | }; 44 | $.ajax({ 45 | url: ajaxurl, 46 | type: 'POST', 47 | data: data, 48 | beforeSend: function () { 49 | // Removes "x" link 50 | $("a[commentid='"+ thisId +"']").hide(); 51 | // Show temp status 52 | $("#author_comment_url_"+ thisId).html( $( '' ).text( WPAkismet.strings['Removing...'] ) ); 53 | }, 54 | success: function (response) { 55 | if (response) { 56 | // Show status/undo link 57 | $("#author_comment_url_"+ thisId) 58 | .attr('cid', thisId) 59 | .addClass('akismet_undo_link_removal') 60 | .html( 61 | $( '' ).text( WPAkismet.strings['URL removed'] ) 62 | ) 63 | .append( ' ' ) 64 | .append( 65 | $( '' ) 66 | .text( WPAkismet.strings['(undo)'] ) 67 | .addClass( 'akismet-span-link' ) 68 | ); 69 | } 70 | } 71 | }); 72 | 73 | return false; 74 | }); 75 | $('.akismet_undo_link_removal').live('click', function () { 76 | var thisId = $(this).attr('cid'); 77 | var thisUrl = $(this).attr('href'); 78 | var data = { 79 | action: 'comment_author_reurl', 80 | _wpnonce: WPAkismet.comment_author_url_nonce, 81 | id: thisId, 82 | url: thisUrl 83 | }; 84 | $.ajax({ 85 | url: ajaxurl, 86 | type: 'POST', 87 | data: data, 88 | beforeSend: function () { 89 | // Show temp status 90 | $("#author_comment_url_"+ thisId).html( $( '' ).text( WPAkismet.strings['Re-adding...'] ) ); 91 | }, 92 | success: function (response) { 93 | if (response) { 94 | // Add "x" link 95 | $("a[commentid='"+ thisId +"']").show(); 96 | // Show link. Core strips leading http://, so let's do that too. 97 | $("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').text( thisUrl.replace( /^http:\/\/(www\.)?/ig, '' ) ); 98 | } 99 | } 100 | }); 101 | 102 | return false; 103 | }); 104 | $('a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type').mouseover(function () { 105 | var wpcomProtocol = ( 'https:' === location.protocol ) ? 'https://' : 'http://'; 106 | // Need to determine size of author column 107 | var thisParentWidth = $(this).parent().width(); 108 | // It changes based on if there is a gravatar present 109 | thisParentWidth = ($(this).parent().find('.grav-hijack').length) ? thisParentWidth - 42 + 'px' : thisParentWidth + 'px'; 110 | if ($(this).find('.mShot').length == 0 && !$(this).hasClass('akismet_undo_link_removal')) { 111 | var self = $( this ); 112 | $('.widefat td').css('overflow', 'visible'); 113 | $(this).css('position', 'relative'); 114 | var thisHref = $.URLEncode( $(this).attr('href') ); 115 | $(this).append('
'); 116 | setTimeout(function () { 117 | self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2'); 118 | }, 6000); 119 | setTimeout(function () { 120 | self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3'); 121 | }, 12000); 122 | } else { 123 | $(this).find('.mShot').css('left', thisParentWidth).show(); 124 | } 125 | }).mouseout(function () { 126 | $(this).find('.mShot').hide(); 127 | }); 128 | $('.checkforspam:not(.button-disabled)').click( function(e) { 129 | $('.checkforspam:not(.button-disabled)').addClass('button-disabled'); 130 | $('.checkforspam-spinner').addClass( 'spinner' ); 131 | akismet_check_for_spam(0, 100); 132 | e.preventDefault(); 133 | }); 134 | 135 | function akismet_check_for_spam(offset, limit) { 136 | $.post( 137 | ajaxurl, 138 | { 139 | 'action': 'akismet_recheck_queue', 140 | 'offset': offset, 141 | 'limit': limit 142 | }, 143 | function(result) { 144 | if (result.processed < limit) { 145 | window.location.reload(); 146 | } 147 | else { 148 | akismet_check_for_spam(offset + limit, limit); 149 | } 150 | } 151 | ); 152 | } 153 | }); 154 | // URL encode plugin 155 | jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/; 156 | while(x1 && m[1]!=''){o+=m[1];x+=m[1].length; 158 | }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16); 159 | o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;} 160 | }); 161 | -------------------------------------------------------------------------------- /plugins/akismet/_inc/form.js: -------------------------------------------------------------------------------- 1 | var ak_js = document.getElementById( "ak_js" ); 2 | 3 | if ( ! ak_js ) { 4 | ak_js = document.createElement( 'input' ); 5 | ak_js.setAttribute( 'id', 'ak_js' ); 6 | ak_js.setAttribute( 'name', 'ak_js' ); 7 | ak_js.setAttribute( 'type', 'hidden' ); 8 | } 9 | else { 10 | ak_js.parentNode.removeChild( ak_js ); 11 | } 12 | 13 | ak_js.setAttribute( 'value', ( new Date() ).getTime() ); 14 | 15 | var commentForm = document.getElementById( 'commentform' ); 16 | 17 | if ( commentForm ) { 18 | commentForm.appendChild( ak_js ); 19 | } 20 | else { 21 | var replyRowContainer = document.getElementById( 'replyrow' ); 22 | 23 | if ( replyRowContainer ) { 24 | var children = replyRowContainer.getElementsByTagName( 'td' ); 25 | 26 | if ( children.length > 0 ) { 27 | children[0].appendChild( ak_js ); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /plugins/akismet/_inc/img/logo-full-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/plugins/akismet/_inc/img/logo-full-2x.png -------------------------------------------------------------------------------- /plugins/akismet/akismet.php: -------------------------------------------------------------------------------- 1 | protect your blog from comment and trackback spam. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) Sign up for an Akismet API key, and 3) Go to your Akismet configuration page, and save your API key. 9 | Version: 3.1.1 10 | Author: Automattic 11 | Author URI: http://automattic.com/wordpress-plugins/ 12 | License: GPLv2 or later 13 | Text Domain: akismet 14 | */ 15 | 16 | /* 17 | This program is free software; you can redistribute it and/or 18 | modify it under the terms of the GNU General Public License 19 | as published by the Free Software Foundation; either version 2 20 | of the License, or (at your option) any later version. 21 | 22 | This program is distributed in the hope that it will be useful, 23 | but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | GNU General Public License for more details. 26 | 27 | You should have received a copy of the GNU General Public License 28 | along with this program; if not, write to the Free Software 29 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30 | */ 31 | 32 | // Make sure we don't expose any info if called directly 33 | if ( !function_exists( 'add_action' ) ) { 34 | echo 'Hi there! I\'m just a plugin, not much I can do when called directly.'; 35 | exit; 36 | } 37 | 38 | define( 'AKISMET_VERSION', '3.1.1' ); 39 | define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' ); 40 | define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 41 | define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 42 | define( 'AKISMET_DELETE_LIMIT', 100000 ); 43 | 44 | register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) ); 45 | register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) ); 46 | 47 | require_once( AKISMET__PLUGIN_DIR . 'class.akismet.php' ); 48 | require_once( AKISMET__PLUGIN_DIR . 'class.akismet-widget.php' ); 49 | 50 | add_action( 'init', array( 'Akismet', 'init' ) ); 51 | 52 | if ( is_admin() ) { 53 | require_once( AKISMET__PLUGIN_DIR . 'class.akismet-admin.php' ); 54 | add_action( 'init', array( 'Akismet_Admin', 'init' ) ); 55 | } 56 | 57 | //add wrapper class around deprecated akismet functions that are referenced elsewhere 58 | require_once( AKISMET__PLUGIN_DIR . 'wrapper.php' ); 59 | 60 | -------------------------------------------------------------------------------- /plugins/akismet/class.akismet-widget.php: -------------------------------------------------------------------------------- 1 | __( 'Display the number of spam comments Akismet has caught' , 'akismet') ) 14 | ); 15 | 16 | if ( is_active_widget( false, false, $this->id_base ) ) { 17 | add_action( 'wp_head', array( $this, 'css' ) ); 18 | } 19 | } 20 | 21 | function css() { 22 | ?> 23 | 24 | 60 | 61 | 72 | 73 |

74 | 75 | 76 |

77 | 78 | 96 | 97 | 100 | 101 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /plugins/akismet/views/start.php: -------------------------------------------------------------------------------- 1 |
status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) : 3 | if ( $akismet_user->status == 'missing' ) :?> 4 |

5 |
6 |
7 | 8 | user_email ); ?> 9 |
10 |
11 | 12 | 13 | 14 | 15 |
16 |
17 | status == 'cancelled' ) :?> 18 |

19 |
20 |
21 | 22 | user_email ); ?> 23 |
24 |
25 | 26 | 27 | 28 | 29 |
30 |
31 | status == 'suspended' ) : ?> 32 |

33 |
34 | 35 |

user_email ); ?>

36 |

37 | 38 |
39 | 40 |

41 |
42 |
43 | 44 | user_email ); ?> 45 |
46 |
47 | 48 | 49 | 50 | 51 |
52 |
53 | 54 |
55 |
56 | 57 |

58 |
59 | __( 'Register a different email address' , 'akismet'), 'classes' => array( 'right', 'button', 'button-secondary' ) ) ); ?> 60 |
61 |
62 |
63 | 64 |

65 |
66 |
67 | 68 | 69 | 70 | 71 |
72 |
73 | 74 |

75 |
76 |
77 | 78 |

79 |
80 | __( 'Get your API key' , 'akismet'), 'classes' => array( 'right', 'button', 'button-primary' ) ) ); ?> 81 |
82 |
83 |
84 | 85 |

86 |
87 |
88 | 89 | 90 | 91 | 92 |
93 |
95 |
-------------------------------------------------------------------------------- /plugins/akismet/views/stats.php: -------------------------------------------------------------------------------- 1 |
2 |

3 | 4 |
-------------------------------------------------------------------------------- /plugins/akismet/views/strict.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

5 |

6 |
7 | -------------------------------------------------------------------------------- /plugins/akismet/wrapper.php: -------------------------------------------------------------------------------- 1 | Note: This plugin will not fully function without CMB2. 6 | * Version: 0.1.0 7 | * Author: jtsternberg 8 | * Author URI: http://dsgnwrks.pro 9 | * Donate link: http://dsgnwrks.pro 10 | * License: GPLv2 11 | * Text Domain: books-cpt 12 | * Domain Path: /languages 13 | */ 14 | 15 | function bookscpt_includes() { 16 | $dir = plugin_dir_path( __FILE__ ); 17 | 18 | include $dir . '/cpt.php'; 19 | include $dir . '/taxonomy.php'; 20 | include $dir . '/custom-fields.php'; 21 | include $dir . '/template-filters.php'; 22 | include $dir . '/submission-form-shortcode.php'; 23 | } 24 | 25 | // Include our includes! 26 | bookscpt_includes(); 27 | 28 | /** 29 | * Flush rewrite rules when this plugin is activated 30 | */ 31 | function bookcpt_rewrite_flush() { 32 | /* 33 | * First, we "add" the custom post type via the above written function. 34 | * Note: "add" is written with quotes, as CPTs don't get added to the DB, 35 | * They are only referenced in the post_type column with a post entry, 36 | * when you add a post of this CPT. 37 | */ 38 | bookcpt_register(); 39 | 40 | /* 41 | * ATTENTION: This is *only* done during plugin activation hook in this example! 42 | * You should *NEVER EVER* do this on every page load!! 43 | */ 44 | flush_rewrite_rules(); 45 | } 46 | register_activation_hook( __FILE__, 'bookcpt_rewrite_flush' ); 47 | 48 | -------------------------------------------------------------------------------- /plugins/books-cpt/cpt.php: -------------------------------------------------------------------------------- 1 | _x( 'Books', 'post type general name', 'books-cpt' ), 11 | 'singular_name' => _x( 'Book', 'post type singular name', 'books-cpt' ), 12 | 'menu_name' => _x( 'Books', 'admin menu', 'books-cpt' ), 13 | 'name_admin_bar' => _x( 'Book', 'add new on admin bar', 'books-cpt' ), 14 | 'add_new' => _x( 'Add New', 'book', 'books-cpt' ), 15 | 'add_new_item' => __( 'Add New Book', 'books-cpt' ), 16 | 'new_item' => __( 'New Book', 'books-cpt' ), 17 | 'edit_item' => __( 'Edit Book', 'books-cpt' ), 18 | 'view_item' => __( 'View Book', 'books-cpt' ), 19 | 'all_items' => __( 'All Books', 'books-cpt' ), 20 | 'search_items' => __( 'Search Books', 'books-cpt' ), 21 | 'parent_item_colon' => __( 'Parent Books:', 'books-cpt' ), 22 | 'not_found' => __( 'No books found.', 'books-cpt' ), 23 | 'not_found_in_trash' => __( 'No books found in Trash.', 'books-cpt' ), 24 | ); 25 | 26 | $args = array( 27 | 'labels' => $labels, 28 | 'menu_icon' => 'dashicons-book-alt', 29 | 'public' => true, 30 | 'publicly_queryable' => true, 31 | 'show_ui' => true, 32 | 'show_in_menu' => true, 33 | 'query_var' => true, 34 | 'rewrite' => array( 'slug' => 'book' ), 35 | 'capability_type' => 'post', 36 | 'has_archive' => true, 37 | 'hierarchical' => false, 38 | 'menu_position' => null, 39 | 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ), 40 | ); 41 | 42 | register_post_type( 'book', $args ); 43 | } 44 | add_action( 'init', 'bookcpt_register' ); 45 | 46 | /** 47 | * Book update messages. 48 | * 49 | * See /wp-admin/edit-form-advanced.php 50 | * 51 | * @link http://codex.wordpress.org/Function_Reference/register_post_type 52 | * 53 | * @param array $messages Existing post update messages. 54 | * 55 | * @return array Amended post update messages with new CPT update messages. 56 | */ 57 | function bookcpt_updated_messages( $messages ) { 58 | $post = get_post(); 59 | $post_type = get_post_type( $post ); 60 | $post_type_object = get_post_type_object( $post_type ); 61 | 62 | $messages['book'] = array( 63 | 0 => '', // Unused. Messages start at index 1. 64 | 1 => __( 'Book updated.', 'books-cpt' ), 65 | 2 => __( 'Custom field updated.', 'books-cpt' ), 66 | 3 => __( 'Custom field deleted.', 'books-cpt' ), 67 | 4 => __( 'Book updated.', 'books-cpt' ), 68 | /* translators: %s: date and time of the revision */ 69 | 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Book restored to revision from %s', 'books-cpt' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 70 | 6 => __( 'Book published.', 'books-cpt' ), 71 | 7 => __( 'Book saved.', 'books-cpt' ), 72 | 8 => __( 'Book submitted.', 'books-cpt' ), 73 | 9 => sprintf( 74 | __( 'Book scheduled for: %1$s.', 'books-cpt' ), 75 | // translators: Publish box date format, see http://php.net/date 76 | date_i18n( __( 'M j, Y @ G:i', 'books-cpt' ), strtotime( $post->post_date ) ) 77 | ), 78 | 10 => __( 'Book draft updated.', 'books-cpt' ) 79 | ); 80 | 81 | if ( $post_type_object->publicly_queryable ) { 82 | $permalink = get_permalink( $post->ID ); 83 | 84 | $view_link = sprintf( ' %s', esc_url( $permalink ), __( 'View book', 'books-cpt' ) ); 85 | $messages[ $post_type ][1] .= $view_link; 86 | $messages[ $post_type ][6] .= $view_link; 87 | $messages[ $post_type ][9] .= $view_link; 88 | 89 | $preview_permalink = add_query_arg( 'preview', 'true', $permalink ); 90 | $preview_link = sprintf( ' %s', esc_url( $preview_permalink ), __( 'Preview book', 'books-cpt' ) ); 91 | $messages[ $post_type ][8] .= $preview_link; 92 | $messages[ $post_type ][10] .= $preview_link; 93 | } 94 | 95 | return $messages; 96 | } 97 | add_filter( 'post_updated_messages', 'bookcpt_updated_messages' ); 98 | -------------------------------------------------------------------------------- /plugins/books-cpt/custom-fields.php: -------------------------------------------------------------------------------- 1 | $prefix . 'metabox', 24 | 'title' => __( 'Book Info', 'books-cpt' ), 25 | 'object_types' => array( 'book', ), // Post type 26 | 'show_on_cb' => 'bookcpt_show_if_front_page', // function should return a bool value 27 | ) ); 28 | 29 | $cmb->add_field( array( 30 | 'name' => __( 'Select Genre', 'books-cpt' ), 31 | 'id' => $prefix . 'genres', 32 | 'type' => 'taxonomy_multicheck', 33 | 'taxonomy' => 'genre', // Taxonomy Slug 34 | ) ); 35 | 36 | $cmb->add_field( array( 37 | 'name' => __( 'Author Name', 'books-cpt' ), 38 | 'id' => $prefix . 'author', 39 | 'type' => 'text', 40 | ) ); 41 | 42 | $cmb->add_field( array( 43 | 'name' => __( 'Author URL', 'books-cpt' ), 44 | 'id' => $prefix . 'author_url', 45 | 'type' => 'text_url', 46 | ) ); 47 | 48 | $cmb->add_field( array( 49 | 'name' => __( 'Submitter Name', 'books-cpt' ), 50 | 'desc' => __( 'Name of person who submitted this book (if applicable)', 'books-cpt' ), 51 | 'id' => $prefix . 'submitter', 52 | 'type' => 'text', 53 | ) ); 54 | 55 | $cmb->add_field( array( 56 | 'name' => __( 'Submitter URL', 'books-cpt' ), 57 | 'desc' => __( 'URL of person who submitted this book (if applicable)', 'books-cpt' ), 58 | 'id' => $prefix . 'submitter_url', 59 | 'type' => 'text_url', 60 | ) ); 61 | 62 | $cmb->add_field( array( 63 | 'name' => __( 'Select Related Books', 'books-cpt' ), 64 | 'id' => $prefix . 'related', 65 | 'type' => 'post_search_text', 66 | 'post_type' => 'book', 67 | ) ); 68 | 69 | } 70 | add_action( 'cmb2_init', 'bookcpt_register_demo_metabox' ); 71 | -------------------------------------------------------------------------------- /plugins/books-cpt/readme.txt: -------------------------------------------------------------------------------- 1 | === Books CPT === 2 | Contributors: jtsternberg 3 | Donate link: http://dsgnwrks.pro 4 | Tags: 5 | Requires at least: 3.6.0 6 | Tested up to: 3.6.0 7 | Stable tag: 0.1.0 8 | License: GPLv2 9 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 | 11 | 12 | == Description == 13 | 14 | Adds a 'Book' CPT to WordPress and corresponding CMB2 custom fields. **Note:** This plugin will not fully function without CMB2. 15 | 16 | == Installation == 17 | 18 | = Manual Installation = 19 | 20 | 1. Upload the entire `/books-cpt` directory to the `/wp-content/plugins/` directory. 21 | 2. Activate Books CPT through the 'Plugins' menu in WordPress. 22 | 23 | == Frequently Asked Questions == 24 | 25 | 26 | == Screenshots == 27 | 28 | 29 | == Changelog == 30 | 31 | = 0.1.0 = 32 | * First release 33 | 34 | == Upgrade Notice == 35 | 36 | = 0.1.0 = 37 | First Release 38 | -------------------------------------------------------------------------------- /plugins/books-cpt/taxonomy.php: -------------------------------------------------------------------------------- 1 | _x( 'Genres', 'taxonomy general name', 'books-cpt' ), 13 | 'singular_name' => _x( 'Genre', 'taxonomy singular name', 'books-cpt' ), 14 | 'search_items' => __( 'Search Genres', 'books-cpt' ), 15 | 'all_items' => __( 'All Genres', 'books-cpt' ), 16 | 'parent_item' => __( 'Parent Genre', 'books-cpt' ), 17 | 'parent_item_colon' => __( 'Parent Genre:', 'books-cpt' ), 18 | 'edit_item' => __( 'Edit Genre', 'books-cpt' ), 19 | 'update_item' => __( 'Update Genre', 'books-cpt' ), 20 | 'add_new_item' => __( 'Add New Genre', 'books-cpt' ), 21 | 'new_item_name' => __( 'New Genre Name', 'books-cpt' ), 22 | 'menu_name' => __( 'Genre', 'books-cpt' ), 23 | ); 24 | 25 | $args = array( 26 | 'hierarchical' => true, 27 | 'labels' => $labels, 28 | 'show_ui' => false, // Keep UI hidden. Will use CMB2 for selection 29 | 'show_admin_column' => true, 30 | 'query_var' => true, 31 | 'rewrite' => array( 'slug' => 'genre' ), 32 | ); 33 | 34 | register_taxonomy( 'genre', array( 'book' ), $args ); 35 | } 36 | add_action( 'init', 'bookcpt_genre_taxonomy', 0 ); 37 | -------------------------------------------------------------------------------- /plugins/books-cpt/template-filters.php: -------------------------------------------------------------------------------- 1 | %s', esc_url( $author_url ), $author_name ); 31 | } 32 | 33 | $author_name = sprintf( _x( 'Submitted by: %s', 'book byline', 'wpsessions' ), $author_name ); 34 | 35 | $content .= sprintf( '

%s

', $author_name ); 36 | } 37 | 38 | $content .= get_the_term_list( $post_id, 'genre', '

'. __( 'Genres: ', 'wpsessions' ), ', ', '

' ); 39 | 40 | return $content; 41 | } 42 | 43 | /** 44 | * Get book meta to be output at the end of the content field 45 | */ 46 | function bookscpt_post_content_meta( $post_id ) { 47 | 48 | $content = ''; 49 | 50 | if ( $submitter_name = get_post_meta( $post_id, '_bookcpt_submitter', 1 ) ) { 51 | 52 | $submitter_name = esc_html( $submitter_name ); 53 | 54 | if ( $submitter_url = get_post_meta( $post_id, '_bookcpt_submitter_url', 1 ) ) { 55 | $submitter_name = sprintf( '%s', esc_url( $submitter_url ), $submitter_name ); 56 | } 57 | 58 | $submitter_name = sprintf( _x( 'Submitted by: %s', 'book byline', 'wpsessions' ), $submitter_name ); 59 | 60 | $content .= sprintf( '

%s

', $submitter_name ); 61 | } 62 | 63 | return $content; 64 | } 65 | 66 | /** 67 | * Replace prev nav with related links 68 | */ 69 | function bookscpt_maybe_filter_previous_post_link( $html ) { 70 | 71 | if ( is_singular( 'book' ) ) { 72 | 73 | $html = ''; 74 | 75 | if ( $related_ids = get_post_meta( get_the_ID(), '_bookcpt_related', 1 ) ) { 76 | 77 | $related_ids = array_map( 'trim', explode( ',', $related_ids ) ); 78 | 79 | foreach ( (array) $related_ids as $related_id ) { 80 | $html .= sprintf( 81 | '
  • %s
  • ', 82 | esc_url( get_permalink( $related_id ) ), 83 | esc_html( get_the_title( $related_id ) ) 84 | ); 85 | } 86 | 87 | $html = sprintf( '
    %s
      %s
    ', __( 'Related Books:', 'wpsessions' ), $html ); 88 | } 89 | 90 | return $html; 91 | } 92 | 93 | return $html; 94 | } 95 | add_filter( 'previous_post_link', 'bookscpt_maybe_filter_previous_post_link' ); 96 | 97 | /** 98 | * Remove next nav on singular books 99 | */ 100 | function bookscpt_maybe_filter_next_post_link( $html ) { 101 | 102 | if ( is_singular( 'book' ) ) { 103 | return ''; 104 | } 105 | 106 | return $html; 107 | } 108 | add_filter( 'next_post_link', 'bookscpt_maybe_filter_next_post_link' ); 109 | -------------------------------------------------------------------------------- /themes/twentyfourteen-child-books/content-homepage.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    > 12 |
    13 | ', '' ); 17 | ?> 18 |
    19 | 20 |
    21 | ', '' ); 27 | ?> 28 |
    29 |
    30 | -------------------------------------------------------------------------------- /themes/twentyfourteen-child-books/footer.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 |
    16 | 17 | 18 | 19 |
    20 | 21 |
    22 |
    23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /themes/twentyfourteen-child-books/front-page.php: -------------------------------------------------------------------------------- 1 | 15 | 16 |
    17 | 18 | 22 |
    23 |
    24 | 25 | 34 | 35 |
    36 |
    37 | 38 |
    39 | 40 | %s

    ', wp_get_attachment_image( $attach_id, 'large' ) ); 54 | } 55 | } 56 | 57 | /** 58 | * Display frontpage video embed 59 | * @link https://github.com/WebDevStudios/CMB2/wiki/Field-Types#oembed Example/Docs 60 | */ 61 | function twentyfourteenbook_video_and_desc() { 62 | $video = get_post_meta( get_the_ID(), '_twentyfourteenbooks_front_embed', 1 ); 63 | 64 | // Check if we have a video 65 | if ( ! empty( $video ) ) { 66 | echo '
    '; 67 | // Display embed 68 | echo wp_oembed_get( esc_url( $video ) ); 69 | if ( $desc = get_post_meta( get_the_ID(), '_twentyfourteenbooks_front_embed_desc', 1 ) ) { 70 | printf( '

    %s

    ', $desc ); 71 | } 72 | echo '
    '; 73 | } 74 | } 75 | 76 | 77 | /** 78 | * Show the address if the address field is not empty 79 | */ 80 | function twentyfourteenbooks_address_field() { 81 | $address = twentyfourteenbooks_get_option( 'address' ); 82 | if ( empty( $address ) ) { 83 | return; 84 | } 85 | 86 | // Set default values for each address key 87 | $address = wp_parse_args( $address, array( 88 | 'address-1' => '', 89 | 'address-2' => '', 90 | 'city' => '', 91 | 'state' => '', 92 | 'zip' => '', 93 | ) ); 94 | 95 | ?> 96 |
    97 |
    98 |

    99 | 100 | 101 |
    102 | 103 |

    104 |

    ,

    105 |
    106 |
    %s
    %s

    ', __( 'Phone', 'wpsessions' ), $phone ); 114 | } 115 | 116 | if ( $email = twentyfourteenbooks_get_option( 'email' ) ) { 117 | printf( '

    %s
    %s

    ', __( 'Email', 'wpsessions' ), $email ); 118 | } 119 | 120 | if ( $hours = twentyfourteenbooks_get_option( 'hours' ) ) { 121 | printf( '

    %s
    %s

    ', __( 'Hours of Operation', 'wpsessions' ), $hours ); 122 | } 123 | 124 | if ( $footer_text = twentyfourteenbooks_get_option( 'footer_text' ) ) { 125 | printf( '', wpautop( $footer_text ) ); 126 | } 127 | } 128 | add_action( 'twentyfourteen_credits', 'twentyfourteenbooks_footer_info' ); 129 | -------------------------------------------------------------------------------- /themes/twentyfourteen-child-books/includes/cmb-fields.php: -------------------------------------------------------------------------------- 1 | object_id !== get_option( 'page_on_front' ) ) { 24 | return false; 25 | } 26 | return true; 27 | } 28 | 29 | /** 30 | * Hook in and add a metabox for the front-page. 31 | */ 32 | function twentyfourteenbooks_register_frontpage_metabox() { 33 | 34 | // Start with an underscore to hide fields from custom fields list 35 | $prefix = '_twentyfourteenbooks_front_'; 36 | 37 | /** 38 | * Sample metabox to demonstrate each field type included 39 | */ 40 | $cmb = new_cmb2_box( array( 41 | 'id' => $prefix . 'metabox', 42 | 'title' => __( 'Homepage Details', 'wpsessions' ), 43 | 'object_types' => array( 'page', ), // Post type 44 | 'show_on_cb' => 'twentyfourteenbooks_show_if_front_page_template', // function should return a bool value 45 | ) ); 46 | 47 | $cmb->add_field( array( 48 | 'name' => __( 'Slogan', 'wpsessions' ), 49 | 'desc' => __( 'If the slogan is entered, it will replace the page title in the template. This markup will be within the title H1 tags.', 'wpsessions' ), 50 | 'id' => $prefix . 'slogan', 51 | 'type' => 'wysiwyg', 52 | 'options' => array( 'textarea_rows' => 5, ), 53 | ) ); 54 | 55 | $cmb->add_field( array( 56 | 'name' => __( 'Random Splash Images', 'wpsessions' ), 57 | 'desc' => __( 'A random image from this list will display with every page-load.', 'wpsessions' ), 58 | 'id' => $prefix . 'splash_images', 59 | 'type' => 'file_list', 60 | 'preview_size' => array( 100, 100 ), // Default: array( 50, 50 ) 61 | ) ); 62 | 63 | $cmb->add_field( array( 64 | 'name' => __( 'Video Embed', 'wpsessions' ), 65 | 'desc' => __( 'Enter a youtube or vimeo URL. Other Supported services are listed at http://codex.wordpress.org/Embeds.', 'wpsessions' ), 66 | 'id' => $prefix . 'embed', 67 | 'type' => 'oembed', 68 | ) ); 69 | 70 | $cmb->add_field( array( 71 | 'name' => __( 'Video Description', 'wpsessions' ), 72 | 'desc' => __( '(optional)', 'wpsessions' ), 73 | 'id' => $prefix . 'embed_desc', 74 | 'type' => 'textarea_small', 75 | ) ); 76 | 77 | } 78 | add_action( 'cmb2_init', 'twentyfourteenbooks_register_frontpage_metabox' ); 79 | -------------------------------------------------------------------------------- /themes/twentyfourteen-child-books/includes/custom-cmb-field-types.php: -------------------------------------------------------------------------------- 1 | 'Alabama','AK'=>'Alaska','AZ'=>'Arizona','AR'=>'Arkansas','CA'=>'California','CO'=>'Colorado','CT'=>'Connecticut','DE'=>'Delaware','DC'=>'District Of Columbia','FL'=>'Florida','GA'=>'Georgia','HI'=>'Hawaii','ID'=>'Idaho','IL'=>'Illinois','IN'=>'Indiana','IA'=>'Iowa','KS'=>'Kansas','KY'=>'Kentucky','LA'=>'Louisiana','ME'=>'Maine','MD'=>'Maryland','MA'=>'Massachusetts','MI'=>'Michigan','MN'=>'Minnesota','MS'=>'Mississippi','MO'=>'Missouri','MT'=>'Montana','NE'=>'Nebraska','NV'=>'Nevada','NH'=>'New Hampshire','NJ'=>'New Jersey','NM'=>'New Mexico','NY'=>'New York','NC'=>'North Carolina','ND'=>'North Dakota','OH'=>'Ohio','OK'=>'Oklahoma','OR'=>'Oregon','PA'=>'Pennsylvania','RI'=>'Rhode Island','SC'=>'South Carolina','SD'=>'South Dakota','TN'=>'Tennessee','TX'=>'Texas','UT'=>'Utah','VT'=>'Vermont','VA'=>'Virginia','WA'=>'Washington','WV'=>'West Virginia','WI'=>'Wisconsin','WY'=>'Wyoming' ); 19 | 20 | $state_options = ''; 21 | foreach ( $state_list as $abrev => $state ) { 22 | $state_options .= ''; 23 | } 24 | 25 | return $state_options; 26 | } 27 | endif; 28 | 29 | if ( ! function_exists( 'cmb2_render_address_field_callback' ) ) : 30 | /** 31 | * Render Address Field 32 | * @link https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types#example-4-multiple-inputs-one-field-lets-create-an-address-field 33 | */ 34 | function cmb2_render_address_field_callback( $field, $value, $post_id, $object_type, $field_type ) { 35 | 36 | // make sure we setup the entire value array 37 | $value = wp_parse_args( $value, array( 38 | 'address-1' => '', 39 | 'address-2' => '', 40 | 'city' => '', 41 | 'state' => '', 42 | 'zip' => '', 43 | ) ); 44 | 45 | ?> 46 |

    47 | input( array( 48 | 'name' => $field_type->_name( '[address-1]' ), 49 | 'id' => $field_type->_id( '_address_1' ), 50 | 'value' => $value['address-1'], 51 | 'desc' => '', 52 | ) ); ?> 53 |
    54 |

    55 | input( array( 56 | 'name' => $field_type->_name( '[address-2]' ), 57 | 'id' => $field_type->_id( '_address_2' ), 58 | 'value' => $value['address-2'], 59 | 'desc' => '', 60 | ) ); ?> 61 |
    62 |

    63 | input( array( 64 | 'class' => 'cmb_text_small', 65 | 'name' => $field_type->_name( '[city]' ), 66 | 'id' => $field_type->_id( '_city' ), 67 | 'value' => $value['city'], 68 | 'desc' => '', 69 | ) ); ?> 70 |
    71 |

    72 | select( array( 73 | 'name' => $field_type->_name( '[state]' ), 74 | 'id' => $field_type->_id( '_state' ), 75 | 'options' => cmb2_get_state_options( $value['state'] ), 76 | 'desc' => '', 77 | ) ); ?> 78 |
    79 |

    80 | input( array( 81 | 'class' => 'cmb_text_small', 82 | 'name' => $field_type->_name( '[zip]' ), 83 | 'id' => $field_type->_id( '_zip' ), 84 | 'value' => $value['zip'], 85 | 'desc' => '', 86 | 'type' => 'number', 87 | ) ); ?> 88 |
    89 |
    90 | _desc( true ); 92 | 93 | } 94 | endif; 95 | add_filter( 'cmb2_render_address', 'cmb2_render_address_field_callback', 10, 5 ); 96 | -------------------------------------------------------------------------------- /themes/twentyfourteen-child-books/includes/theme-options-cmb.php: -------------------------------------------------------------------------------- 1 | title = __( 'Site Options', 'wpsessions' ); 40 | } 41 | 42 | /** 43 | * Initiate our hooks 44 | * @since 0.1.0 45 | */ 46 | public function hooks() { 47 | add_action( 'admin_init', array( $this, 'init' ) ); 48 | add_action( 'admin_menu', array( $this, 'add_options_page' ) ); 49 | add_action( 'cmb2_init', array( $this, 'add_options_page_metabox' ) ); 50 | } 51 | 52 | 53 | /** 54 | * Register our setting to WP 55 | * @since 0.1.0 56 | */ 57 | public function init() { 58 | register_setting( $this->key, $this->key ); 59 | } 60 | 61 | /** 62 | * Add menu options page 63 | * @since 0.1.0 64 | */ 65 | public function add_options_page() { 66 | $this->options_page = add_menu_page( $this->title, $this->title, 'manage_options', $this->key, array( $this, 'admin_page_display' ) ); 67 | 68 | // Include CMB CSS in the head to avoid FOUT 69 | add_action( "admin_print_styles-{$this->options_page}", array( 'CMB2_hookup', 'enqueue_cmb_css' ) ); 70 | } 71 | 72 | /** 73 | * Admin page markup. Mostly handled by CMB2 74 | * @since 0.1.0 75 | */ 76 | public function admin_page_display() { 77 | ?> 78 |
    79 |

    80 | metabox_id, $this->key, array( 'cmb_styles' => false ) ); ?> 81 |
    82 | $this->metabox_id, 93 | 'hookup' => false, 94 | 'show_on' => array( 95 | // These are important, don't remove 96 | 'key' => 'options-page', 97 | 'value' => array( $this->key, ) 98 | ), 99 | ) ); 100 | 101 | // Set our CMB2 fields 102 | 103 | /* 104 | * Custom address field, https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types#example-4-multiple-inputs-one-field-lets-create-an-address-field 105 | */ 106 | $cmb->add_field( array( 107 | 'name' => __( 'Business Address', 'wpsessions' ), 108 | 'desc' => __( 'Enter the address for contact.', 'wpsessions' ), 109 | 'id' => 'address', 110 | 'type' => 'address', 111 | ) ); 112 | 113 | $cmb->add_field( array( 114 | 'name' => __( 'Business Phone', 'wpsessions' ), 115 | 'id' => 'phone', 116 | 'type' => 'text', 117 | 'attributes' => array( 118 | 'type' => 'phone', 119 | ), 120 | ) ); 121 | 122 | $cmb->add_field( array( 123 | 'name' => __( 'Contact Email', 'wpsessions' ), 124 | 'id' => 'email', 125 | 'type' => 'text_email', 126 | ) ); 127 | 128 | $cmb->add_field( array( 129 | 'name' => __( 'Hours of Operation', 'wpsessions' ), 130 | 'id' => 'hours', 131 | 'type' => 'text_medium', 132 | 'attributes' => array( 133 | 'placeholder' => __( 'M-F 9:30-5:00 EST', 'wpsessions' ), 134 | ), 135 | ) ); 136 | 137 | $cmb->add_field( array( 138 | 'name' => __( 'Footer Text', 'wpsessions' ), 139 | 'desc' => __( 'contains address/copyright, etc.', 'wpsessions' ), 140 | 'id' => 'settingstitle', 141 | 'type' => 'title', 142 | ) ); 143 | 144 | $cmb->add_field( array( 145 | 'id' => 'footer_text', 146 | 'type' => 'wysiwyg', 147 | 'options' => array( 'textarea_rows' => 8, ), 148 | ) ); 149 | 150 | } 151 | 152 | /** 153 | * Public getter method for retrieving protected/private variables 154 | * @since 0.1.0 155 | * @param string $field Field to retrieve 156 | * @return mixed Field value or exception is thrown 157 | */ 158 | public function __get( $field ) { 159 | // Allowed fields to retrieve 160 | if ( in_array( $field, array( 'key', 'metabox_id', 'title', 'options_page' ), true ) ) { 161 | return $this->{$field}; 162 | } 163 | 164 | throw new Exception( 'Invalid property: ' . $field ); 165 | } 166 | 167 | } 168 | 169 | /** 170 | * Helper function to get/return the Twentyfourteenbooks_Admin object 171 | * @since 0.1.0 172 | * @return Twentyfourteenbooks_Admin object 173 | */ 174 | function twentyfourteenbooks_admin() { 175 | static $object = null; 176 | if ( is_null( $object ) ) { 177 | $object = new Twentyfourteenbooks_Admin(); 178 | $object->hooks(); 179 | } 180 | 181 | return $object; 182 | } 183 | 184 | /** 185 | * Wrapper function around cmb2_get_option 186 | * @since 0.1.0 187 | * @param string $key Options array key 188 | * @return mixed Option value 189 | */ 190 | function twentyfourteenbooks_get_option( $key = '' ) { 191 | return cmb2_get_option( twentyfourteenbooks_admin()->key, $key ); 192 | } 193 | 194 | // Get it started 195 | twentyfourteenbooks_admin(); 196 | -------------------------------------------------------------------------------- /themes/twentyfourteen-child-books/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/themes/twentyfourteen-child-books/screenshot.png -------------------------------------------------------------------------------- /themes/twentyfourteen-child-books/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | Theme Name: Twenty Fourteen -- BOOKS! 3 | Theme URI: https://dsgnwrks.pro 4 | Author: jtsternberg 5 | Author URI: https://dsgnworks.pro 6 | Description: A Book childtheme for the CMB2 WPSessions demon 7 | Version: 1.0.0 8 | License: GNU General Public License v2 or later 9 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 | Template: twentyfourteen 11 | */ 12 | 13 | @import url("../twentyfourteen/style.css"); 14 | 15 | .front-page-embed { 16 | background: #eee; 17 | padding: 10px 10px 1px; 18 | margin-bottom: 24px; 19 | } 20 | -------------------------------------------------------------------------------- /themes/twentyfourteen/404.php: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 |
    14 |
    15 | 16 | 19 | 20 |
    21 |

    22 | 23 | 24 |
    25 | 26 |
    27 |
    28 | 29 | 21 | 22 |
    23 |
    24 | 25 | 26 | 27 | 46 | 47 | 68 |
    69 |
    70 | 71 | 13 | 14 |
    15 |
    16 | 17 | 18 | 19 |
    20 |

    21 | 33 |

    34 | 35 |
    36 | 37 |
    38 | 39 | 67 | 68 |
    69 |
    70 | 71 | 13 | 14 |
    15 |
    16 | 17 | 18 | 19 |
    20 |

    21 | 22 | %s
    ', $term_description ); 27 | endif; 28 | ?> 29 | 30 | 31 | 52 | 53 |
    54 | 55 | 20 | 21 |
    22 | 23 | 24 | 25 |

    26 | 30 |

    31 | 32 | 1 && get_option( 'page_comments' ) ) : ?> 33 | 38 | 39 | 40 |
      41 | 'ol', 44 | 'short_ping' => true, 45 | 'avatar_size' => 34, 46 | ) ); 47 | ?> 48 |
    49 | 50 | 1 && get_option( 'page_comments' ) ) : ?> 51 | 56 | 57 | 58 | 59 |

    60 | 61 | 62 | 63 | 64 | 65 | 66 |
    67 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content-aside.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    > 12 | 13 | 14 |
    15 | 16 | 19 | ', '' ); 24 | else : 25 | the_title( '

    ', '

    ' ); 26 | endif; 27 | ?> 28 | 29 | 42 |
    43 | 44 |
    45 | →', 'twentyfourteen' ), 49 | the_title( '', '', false ) 50 | ) ); 51 | 52 | wp_link_pages( array( 53 | 'before' => '', 55 | 'link_before' => '', 56 | 'link_after' => '', 57 | ) ); 58 | ?> 59 |
    60 | 61 | ', '', '' ); ?> 62 |
    63 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content-audio.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    > 12 | 13 | 14 |
    15 | 16 | 19 | ', '' ); 24 | else : 25 | the_title( '

    ', '

    ' ); 26 | endif; 27 | ?> 28 | 29 | 42 |
    43 | 44 |
    45 | →', 'twentyfourteen' ), 49 | the_title( '', '', false ) 50 | ) ); 51 | 52 | wp_link_pages( array( 53 | 'before' => '', 55 | 'link_before' => '', 56 | 'link_after' => '', 57 | ) ); 58 | ?> 59 |
    60 | 61 | ', '', '' ); ?> 62 |
    63 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content-featured-post.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    > 12 | 13 | 23 | 24 | 25 |
    26 | 27 | 30 | 31 | 32 | ','' ); ?> 33 |
    34 |
    35 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content-gallery.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    > 12 | 13 | 14 |
    15 | 16 | 19 | ', '' ); 24 | else : 25 | the_title( '

    ', '

    ' ); 26 | endif; 27 | ?> 28 | 29 | 42 |
    43 | 44 |
    45 | →', 'twentyfourteen' ), 49 | the_title( '', '', false ) 50 | ) ); 51 | 52 | wp_link_pages( array( 53 | 'before' => '', 55 | 'link_before' => '', 56 | 'link_after' => '', 57 | ) ); 58 | ?> 59 |
    60 | 61 | ', '', '' ); ?> 62 |
    63 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content-image.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    > 12 | 13 | 14 |
    15 | 16 | 19 | ', '' ); 24 | else : 25 | the_title( '

    ', '

    ' ); 26 | endif; 27 | ?> 28 | 29 | 42 |
    43 | 44 |
    45 | →', 'twentyfourteen' ), 49 | the_title( '', '', false ) 50 | ) ); 51 | 52 | wp_link_pages( array( 53 | 'before' => '', 55 | 'link_before' => '', 56 | 'link_after' => '', 57 | ) ); 58 | ?> 59 |
    60 | 61 | ', '', '' ); ?> 62 |
    63 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content-link.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    > 12 | 13 | 14 |
    15 | 16 | 19 | ', '' ); 24 | else : 25 | the_title( '

    ', '

    ' ); 26 | endif; 27 | ?> 28 | 29 | 42 |
    43 | 44 |
    45 | →', 'twentyfourteen' ), 49 | the_title( '', '', false ) 50 | ) ); 51 | 52 | wp_link_pages( array( 53 | 'before' => '', 55 | 'link_before' => '', 56 | 'link_after' => '', 57 | ) ); 58 | ?> 59 |
    60 | 61 | ', '', '' ); ?> 62 |
    63 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content-none.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 14 | 15 |
    16 | 17 | 18 |

    Get started here.', 'twentyfourteen' ), admin_url( 'post-new.php' ) ); ?>

    19 | 20 | 21 | 22 |

    23 | 24 | 25 | 26 | 27 |

    28 | 29 | 30 | 31 |
    32 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content-page.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    > 12 |

    ', '

    ' ); 16 | ?> 17 | 18 |
    19 | '', 24 | 'link_before' => '', 25 | 'link_after' => '', 26 | ) ); 27 | 28 | edit_post_link( __( 'Edit', 'twentyfourteen' ), '', '' ); 29 | ?> 30 |
    31 |
    32 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content-quote.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    > 12 | 13 | 14 |
    15 | 16 | 19 | ', '' ); 24 | else : 25 | the_title( '

    ', '

    ' ); 26 | endif; 27 | ?> 28 | 29 | 42 |
    43 | 44 |
    45 | →', 'twentyfourteen' ), 49 | the_title( '', '', false ) 50 | ) ); 51 | 52 | wp_link_pages( array( 53 | 'before' => '', 55 | 'link_before' => '', 56 | 'link_after' => '', 57 | ) ); 58 | ?> 59 |
    60 | 61 | ', '', '' ); ?> 62 |
    63 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content-video.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
    > 12 | 13 | 14 |
    15 | 16 | 19 | ', '' ); 24 | else : 25 | the_title( '

    ', '

    ' ); 26 | endif; 27 | ?> 28 | 29 | 42 |
    43 | 44 |
    45 | →', 'twentyfourteen' ), 49 | the_title( '', '', false ) 50 | ) ); 51 | 52 | wp_link_pages( array( 53 | 'before' => '', 55 | 'link_before' => '', 56 | 'link_after' => '', 57 | ) ); 58 | ?> 59 |
    60 | 61 | ', '', '' ); ?> 62 |
    63 | -------------------------------------------------------------------------------- /themes/twentyfourteen/content.php: -------------------------------------------------------------------------------- 1 | 12 | 13 |
    > 14 | 15 | 16 |
    17 | 18 | 21 | ', '' ); 26 | else : 27 | the_title( '

    ', '

    ' ); 28 | endif; 29 | ?> 30 | 31 | 45 |
    46 | 47 | 48 |
    49 | 50 |
    51 | 52 |
    53 | →', 'twentyfourteen' ), 57 | the_title( '', '', false ) 58 | ) ); 59 | 60 | wp_link_pages( array( 61 | 'before' => '', 63 | 'link_before' => '', 64 | 'link_after' => '', 65 | ) ); 66 | ?> 67 |
    68 | 69 | 70 | ', '', '' ); ?> 71 |
    72 | -------------------------------------------------------------------------------- /themes/twentyfourteen/featured-content.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 40 | -------------------------------------------------------------------------------- /themes/twentyfourteen/footer.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 |
    16 | 17 | 18 | 19 |
    20 | 21 | 22 |
    23 |
    24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /themes/twentyfourteen/genericons/COPYING.txt: -------------------------------------------------------------------------------- 1 | Genericons is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 2 | 3 | The fonts are distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 4 | 5 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 6 | 7 | As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. 8 | 9 | This license does not convey any intellectual property rights to third party trademarks that may be included in the icon font; such marks remain subject to all rights and guidelines of use of their owner. -------------------------------------------------------------------------------- /themes/twentyfourteen/genericons/Genericons-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/themes/twentyfourteen/genericons/Genericons-Regular.otf -------------------------------------------------------------------------------- /themes/twentyfourteen/genericons/README.txt: -------------------------------------------------------------------------------- 1 | ___ ____ __ _ ____ ____ __ ___ __ __ _ ____ 2 | / __)( __)( ( \( __)( _ \( )/ __)/ \ ( ( \/ ___) 3 | ( (_ \ ) _) / / ) _) ) / )(( (__( O )/ /\___ \ 4 | \___/(____)\_)__)(____)(__\_)(__)\___)\__/ \_)__)(____/ 5 | 6 | 7 | Genericons are vector icons embedded in a webfont designed to be clean and simple keeping with a generic aesthetic. 8 | 9 | Use genericons for instant HiDPI, to change icon colors on the fly, or even with CSS effects such as drop-shadows or gradients! 10 | 11 | 12 | _ _ ____ ____ ____ ____ 13 | | | [__ |__| | __ |___ 14 | |__| ___] | | |__] |___ 15 | 16 | 17 | To use it, place the font folder in your stylesheet directory and paste this in your CSS file: 18 | 19 | /* =Genericons, thanks to FontSquirrel.com for conversion! 20 | -------------------------------------------------------------- */ 21 | @font-face { 22 | font-family: 'Genericons'; 23 | src: url('font/genericons-regular-webfont.eot'); 24 | src: url('font/genericons-regular-webfont.eot?#iefix') format('embedded-opentype'), 25 | url('font/genericons-regular-webfont.woff') format('woff'), 26 | url('font/genericons-regular-webfont.ttf') format('truetype'), 27 | url('font/genericons-regular-webfont.svg#genericonsregular') format('svg'); 28 | font-weight: normal; 29 | font-style: normal; 30 | 31 | } 32 | 33 | Note: the above only works if you don't use a CDN. If you do, or don't know what that is, you should use the syntax that's embedded in genericons.css. 34 | 35 | From then on, you can create an icon like this: 36 | 37 | .my-icon:before { 38 | content: '\f101'; 39 | display: inline-block; 40 | -webkit-font-smoothing: antialiased; 41 | font: normal 16px/1 'Genericons'; 42 | vertical-align: top; 43 | } 44 | 45 | This will output a comment icon before every element with the class "my-icon". The "content: '\f101';" part of this CSS is easily copied from the helper tool at http://genericons.com/ 46 | 47 | You can also use the bundled example.css if you'd rather insert the icons using HTML tags. 48 | 49 | 50 | _ _ ____ ___ ____ ____ 51 | |\ | | | | |___ [__ 52 | | \| |__| | |___ ___] 53 | 54 | 55 | Photoshop mockups: 56 | 57 | Genericons-Regular.otf found in the root directory of this zip has not been web-font-ified. So you can drop it in your system fonts folder and use the font in Photoshop if you like. 58 | 59 | For those of you using Genericons in your Photoshop mockup, remember to delete the old version of the font from Font Book, and grab the new one from the zip file. This also affects using it in your webdesigns: if you have an old version of the font installed locally, that's the font that'll be used in your website as well, so if you're missing icons, check for old versions of the font on your system. 60 | 61 | Pixel grid: 62 | 63 | Note that Genericons has been designed for a 16x16 pixel grid. That means it'll look sharp at font-size: 16px exactly. It'll also be crisp at multiples thereof, such as 32px or 64px. It'll also look reasonably crisp at in-between font sizes such as 24px or 48px, but not quite as crisp as 16 or 32. Please don't set the font-size to 17px, though, that'll just look terrible. 64 | 65 | Also note the CSS property "-webkit-font-smoothing: antialiased". That makes the icons look great in WebKit browsers. Please see http://noscope.com/2012/font-smoothing for more info. 66 | 67 | Updates: 68 | 69 | We don't often update icons, but do very carefully when we get good feedback suggesting improvements. Please be mindful if you upgrade, and check that the updated icons behave as you intended. 70 | 71 | 72 | 73 | ____ _ _ ____ _ _ ____ ____ _ ____ ____ 74 | | |__| |__| |\ | | __ |___ | | | | __ 75 | |___ | | | | | \| |__] |___ |___ |__| |__] 76 | 77 | V3.0.3: 78 | Bunch of updates mostly. 79 | - Two new icons, Dropbox and Fullscreen. 80 | - Updates to all icons containing an exclamation mark. 81 | - Updates to Image and Quote. 82 | - Nicer "Share" icon. 83 | - Bigger default Linkedin icon. 84 | 85 | V3.0.2: 86 | A slew of new stuff and updates. 87 | - Social icons: Skype, Digg, Reddit, Stumbleupon, Pocket. 88 | - New generic icons: heart, lock and print. 89 | - New editing icons: code, bold, italic, image 90 | - New interaction icons: subscribe, unsubscribe, subscribed, reply all, reply, flag. 91 | - The hyperlink icon has been updated to be clearer, chunkier. 92 | - The "home" icon has been updated for style, size and clarity. 93 | - The email icon has been updated for style and clarity, and to fit with the new subscribe icons. 94 | - The document icon has been updated for style. 95 | - The "pin" icon has been updated for style and clarity. 96 | - The Twitter icon has been scaled down to fit with the other social icons. 97 | 98 | V3.0.1: 99 | Mostly maintenance. 100 | - Fixed an issue with the example page that showed an old "top" icon instead of the actual NEW "refresh" icon. 101 | - Added inverse Google+ and Path. 102 | - Replaced tabs with spaces in the helper CSS. 103 | - Changed the Genericons.com copy/paste tool to serve span's instead of div's for casual icon insertion. It's being converted to "inline-block" anyway. 104 | 105 | V3.0: 106 | Mainly maintenance and a few new icons. 107 | - Fast forward, rewind, PollDaddy, Notice, Info, Help, Portfolio 108 | - Updated the feed icon. It's a bit smaller now for consistency, the previous one was rather big. 109 | - So, the previous version numbering, 2.09, wasn't very PHP version compare friendly. So from now on it'll be 3.0, 3.1 etc. Props Ipstenu. 110 | - Genericons.com now has a mini release blog. 111 | - The CSS has prettier formatting, props Konstantin Obenland. 112 | 113 | V2.09: 114 | Updated Facebook icon to new version. Updated Instagram logo to use new one-color version. Updated Google+ icon to use same radius as Instagram and Facebook. Added a bunch of new icons, cog, unapprove, cart, media player buttons, tablet, send to tablet. 115 | 116 | V2.06: 117 | Included Base64 encoded version. This is necessary for Genericons to work with CDNs in Firefox. Firefox blocks fonts linked from a different domain. A CDN (typically s.example.com) usually puts the font on a subdomain, and is hence blocked in Firefox. 118 | 119 | V2.05: 120 | Added a bunch of new icons, including upload to cloud, download to cloud, many more. 121 | 122 | V2: 123 | Initial public release -------------------------------------------------------------------------------- /themes/twentyfourteen/genericons/font/genericons-regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/themes/twentyfourteen/genericons/font/genericons-regular-webfont.eot -------------------------------------------------------------------------------- /themes/twentyfourteen/genericons/font/genericons-regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/themes/twentyfourteen/genericons/font/genericons-regular-webfont.ttf -------------------------------------------------------------------------------- /themes/twentyfourteen/genericons/font/genericons-regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtsternberg/CMB2-WPSessions-Demo/5dfe664494f73dba14277da291669804dc7c47aa/themes/twentyfourteen/genericons/font/genericons-regular-webfont.woff -------------------------------------------------------------------------------- /themes/twentyfourteen/header.php: -------------------------------------------------------------------------------- 1 | section and everything up till
    6 | * 7 | * @package WordPress 8 | * @subpackage Twenty_Fourteen 9 | * @since Twenty Fourteen 1.0 10 | */ 11 | ?> 12 | 15 | 18 | 19 | > 20 | 21 | 22 | 23 | 24 | <?php wp_title( '|', true, 'right' ); ?> 25 | 26 | 27 | 30 | 31 | 32 | 33 | > 34 |
    35 | 36 | 41 | 42 | 43 | 64 | 65 |
    66 | -------------------------------------------------------------------------------- /themes/twentyfourteen/image.php: -------------------------------------------------------------------------------- 1 | 15 | 16 |
    17 |
    18 | 19 | 23 |
    > 24 |
    25 | ', '' ); ?> 26 | 27 | 36 |
    37 | 38 |
    39 |
    40 |
    41 | 42 |
    43 | 44 | 45 |
    46 | 47 |
    48 | 49 |
    50 | 51 | '', 56 | 'link_before' => '', 57 | 'link_after' => '', 58 | ) ); 59 | ?> 60 |
    61 |
    62 | 63 |
    ' ); ?> 67 |
    68 | 69 | 70 | 71 | 72 | 73 | 74 |
    75 | 76 | 77 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /themes/twentyfourteen/images/pattern-light.svg: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /themes/twentyfourteen/inc/back-compat.php: -------------------------------------------------------------------------------- 1 |

    %s

    ', $message ); 39 | } 40 | 41 | /** 42 | * Prevent the Customizer from being loaded on WordPress versions prior to 3.6. 43 | * 44 | * @since Twenty Fourteen 1.0 45 | */ 46 | function twentyfourteen_customize() { 47 | wp_die( sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ), '', array( 48 | 'back_link' => true, 49 | ) ); 50 | } 51 | add_action( 'load-customize.php', 'twentyfourteen_customize' ); 52 | 53 | /** 54 | * Prevent the Theme Preview from being loaded on WordPress versions prior to 3.4. 55 | * 56 | * @since Twenty Fourteen 1.0 57 | */ 58 | function twentyfourteen_preview() { 59 | if ( isset( $_GET['preview'] ) ) { 60 | wp_die( sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ) ); 61 | } 62 | } 63 | add_action( 'template_redirect', 'twentyfourteen_preview' ); 64 | -------------------------------------------------------------------------------- /themes/twentyfourteen/inc/custom-header.php: -------------------------------------------------------------------------------- 1 | Header screen. 34 | * @type string $admin_preview_callback Callback function used to create the custom header markup in 35 | * the Appearance > Header screen. 36 | * } 37 | */ 38 | add_theme_support( 'custom-header', apply_filters( 'twentyfourteen_custom_header_args', array( 39 | 'default-text-color' => 'fff', 40 | 'width' => 1260, 41 | 'height' => 240, 42 | 'flex-height' => true, 43 | 'wp-head-callback' => 'twentyfourteen_header_style', 44 | 'admin-head-callback' => 'twentyfourteen_admin_header_style', 45 | 'admin-preview-callback' => 'twentyfourteen_admin_header_image', 46 | ) ) ); 47 | } 48 | add_action( 'after_setup_theme', 'twentyfourteen_custom_header_setup' ); 49 | 50 | if ( ! function_exists( 'twentyfourteen_header_style' ) ) : 51 | /** 52 | * Styles the header image and text displayed on the blog 53 | * 54 | * @see twentyfourteen_custom_header_setup(). 55 | * 56 | */ 57 | function twentyfourteen_header_style() { 58 | $text_color = get_header_textcolor(); 59 | 60 | // If no custom color for text is set, let's bail. 61 | if ( display_header_text() && $text_color === get_theme_support( 'custom-header', 'default-text-color' ) ) 62 | return; 63 | 64 | // If we get this far, we have custom styles. 65 | ?> 66 | 86 | Header screen. 94 | * 95 | * @see twentyfourteen_custom_header_setup() 96 | * 97 | * @since Twenty Fourteen 1.0 98 | */ 99 | function twentyfourteen_admin_header_style() { 100 | ?> 101 | 125 | Header screen. 132 | * 133 | * @see twentyfourteen_custom_header_setup() 134 | * 135 | * @since Twenty Fourteen 1.0 136 | */ 137 | function twentyfourteen_admin_header_image() { 138 | ?> 139 |
    140 | 141 | 142 | 143 |

    144 |
    145 | get_setting( 'blogname' )->transport = 'postMessage'; 20 | $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; 21 | $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; 22 | 23 | // Rename the label to "Site Title Color" because this only affects the site title in this theme. 24 | $wp_customize->get_control( 'header_textcolor' )->label = __( 'Site Title Color', 'twentyfourteen' ); 25 | 26 | // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. 27 | $wp_customize->get_control( 'display_header_text' )->label = __( 'Display Site Title & Tagline', 'twentyfourteen' ); 28 | 29 | // Add custom description to Colors and Background controls or sections. 30 | if ( property_exists( $wp_customize->get_control( 'background_color' ), 'description' ) ) { 31 | $wp_customize->get_control( 'background_color' )->description = __( 'May only be visible on wide screens.', 'twentyfourteen' ); 32 | $wp_customize->get_control( 'background_image' )->description = __( 'May only be visible on wide screens.', 'twentyfourteen' ); 33 | } else { 34 | $wp_customize->get_section( 'colors' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' ); 35 | $wp_customize->get_section( 'background_image' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' ); 36 | } 37 | 38 | // Add the featured content section in case it's not already there. 39 | $wp_customize->add_section( 'featured_content', array( 40 | 'title' => __( 'Featured Content', 'twentyfourteen' ), 41 | 'description' => sprintf( __( 'Use a tag to feature your posts. If no posts match the tag, sticky posts will be displayed instead.', 'twentyfourteen' ), 42 | esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), 43 | admin_url( 'edit.php?show_sticky=1' ) 44 | ), 45 | 'priority' => 130, 46 | 'active_callback' => 'is_front_page', 47 | ) ); 48 | 49 | // Add the featured content layout setting and control. 50 | $wp_customize->add_setting( 'featured_content_layout', array( 51 | 'default' => 'grid', 52 | 'sanitize_callback' => 'twentyfourteen_sanitize_layout', 53 | ) ); 54 | 55 | $wp_customize->add_control( 'featured_content_layout', array( 56 | 'label' => __( 'Layout', 'twentyfourteen' ), 57 | 'section' => 'featured_content', 58 | 'type' => 'select', 59 | 'choices' => array( 60 | 'grid' => __( 'Grid', 'twentyfourteen' ), 61 | 'slider' => __( 'Slider', 'twentyfourteen' ), 62 | ), 63 | ) ); 64 | } 65 | add_action( 'customize_register', 'twentyfourteen_customize_register' ); 66 | 67 | /** 68 | * Sanitize the Featured Content layout value. 69 | * 70 | * @since Twenty Fourteen 1.0 71 | * 72 | * @param string $layout Layout type. 73 | * @return string Filtered layout type (grid|slider). 74 | */ 75 | function twentyfourteen_sanitize_layout( $layout ) { 76 | if ( ! in_array( $layout, array( 'grid', 'slider' ) ) ) { 77 | $layout = 'grid'; 78 | } 79 | 80 | return $layout; 81 | } 82 | 83 | /** 84 | * Bind JS handlers to make Customizer preview reload changes asynchronously. 85 | * 86 | * @since Twenty Fourteen 1.0 87 | */ 88 | function twentyfourteen_customize_preview_js() { 89 | wp_enqueue_script( 'twentyfourteen_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20131205', true ); 90 | } 91 | add_action( 'customize_preview_init', 'twentyfourteen_customize_preview_js' ); 92 | 93 | /** 94 | * Add contextual help to the Themes and Post edit screens. 95 | * 96 | * @since Twenty Fourteen 1.0 97 | */ 98 | function twentyfourteen_contextual_help() { 99 | if ( 'admin_head-edit.php' === current_filter() && 'post' !== $GLOBALS['typenow'] ) { 100 | return; 101 | } 102 | 103 | get_current_screen()->add_help_tab( array( 104 | 'id' => 'twentyfourteen', 105 | 'title' => __( 'Twenty Fourteen', 'twentyfourteen' ), 106 | 'content' => 107 | '
      ' . 108 | '
    • ' . sprintf( __( 'The home page features your choice of up to 6 posts prominently displayed in a grid or slider, controlled by a tag; you can change the tag and layout in Appearance → Customize. If no posts match the tag, sticky posts will be displayed instead.', 'twentyfourteen' ), esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), admin_url( 'customize.php' ), admin_url( 'edit.php?show_sticky=1' ) ) . '
    • ' . 109 | '
    • ' . sprintf( __( 'Enhance your site design by using Featured Images for posts you’d like to stand out (also known as post thumbnails). This allows you to associate an image with your post without inserting it. Twenty Fourteen uses featured images for posts and pages—above the title—and in the Featured Content area on the home page.', 'twentyfourteen' ), 'https://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail' ) . '
    • ' . 110 | '
    • ' . sprintf( __( 'For an in-depth tutorial, and more tips and tricks, visit the Twenty Fourteen documentation.', 'twentyfourteen' ), 'https://codex.wordpress.org/Twenty_Fourteen' ) . '
    • ' . 111 | '
    ', 112 | ) ); 113 | } 114 | add_action( 'admin_head-themes.php', 'twentyfourteen_contextual_help' ); 115 | add_action( 'admin_head-edit.php', 'twentyfourteen_contextual_help' ); 116 | -------------------------------------------------------------------------------- /themes/twentyfourteen/js/customizer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Twenty Fourteen Customizer enhancements for a better user experience. 3 | * 4 | * Contains handlers to make Customizer preview reload changes asynchronously. 5 | */ 6 | ( function( $ ) { 7 | // Site title and description. 8 | wp.customize( 'blogname', function( value ) { 9 | value.bind( function( to ) { 10 | $( '.site-title a' ).text( to ); 11 | } ); 12 | } ); 13 | wp.customize( 'blogdescription', function( value ) { 14 | value.bind( function( to ) { 15 | $( '.site-description' ).text( to ); 16 | } ); 17 | } ); 18 | // Header text color. 19 | wp.customize( 'header_textcolor', function( value ) { 20 | value.bind( function( to ) { 21 | if ( 'blank' === to ) { 22 | $( '.site-title, .site-description' ).css( { 23 | 'clip': 'rect(1px, 1px, 1px, 1px)', 24 | 'position': 'absolute' 25 | } ); 26 | } else { 27 | $( '.site-title, .site-description' ).css( { 28 | 'clip': 'auto', 29 | 'position': 'static' 30 | } ); 31 | 32 | $( '.site-title a' ).css( { 33 | 'color': to 34 | } ); 35 | } 36 | } ); 37 | } ); 38 | } )( jQuery ); -------------------------------------------------------------------------------- /themes/twentyfourteen/js/featured-content-admin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Twenty Fourteen Featured Content admin behavior: add a tag suggestion 3 | * when changing the tag. 4 | */ 5 | /* global ajaxurl:true */ 6 | 7 | jQuery( document ).ready( function( $ ) { 8 | $( '#customize-control-featured-content-tag-name input' ).suggest( ajaxurl + '?action=ajax-tag-search&tax=post_tag', { delay: 500, minchars: 2 } ); 9 | }); 10 | -------------------------------------------------------------------------------- /themes/twentyfourteen/js/functions.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Theme functions file 3 | * 4 | * Contains handlers for navigation, accessibility, header sizing 5 | * footer widgets and Featured Content slider 6 | * 7 | */ 8 | ( function( $ ) { 9 | var body = $( 'body' ), 10 | _window = $( window ), 11 | nav, button, menu; 12 | 13 | nav = $( '#primary-navigation' ); 14 | button = nav.find( '.menu-toggle' ); 15 | menu = nav.find( '.nav-menu' ); 16 | 17 | // Enable menu toggle for small screens. 18 | ( function() { 19 | if ( ! nav || ! button ) { 20 | return; 21 | } 22 | 23 | // Hide button if menu is missing or empty. 24 | if ( ! menu || ! menu.children().length ) { 25 | button.hide(); 26 | return; 27 | } 28 | 29 | button.on( 'click.twentyfourteen', function() { 30 | nav.toggleClass( 'toggled-on' ); 31 | if ( nav.hasClass( 'toggled-on' ) ) { 32 | $( this ).attr( 'aria-expanded', 'true' ); 33 | menu.attr( 'aria-expanded', 'true' ); 34 | } else { 35 | $( this ).attr( 'aria-expanded', 'false' ); 36 | menu.attr( 'aria-expanded', 'false' ); 37 | } 38 | } ); 39 | } )(); 40 | 41 | /* 42 | * Makes "skip to content" link work correctly in IE9 and Chrome for better 43 | * accessibility. 44 | * 45 | * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ 46 | */ 47 | _window.on( 'hashchange.twentyfourteen', function() { 48 | var hash = location.hash.substring( 1 ), element; 49 | 50 | if ( ! hash ) { 51 | return; 52 | } 53 | 54 | element = document.getElementById( hash ); 55 | 56 | if ( element ) { 57 | if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) { 58 | element.tabIndex = -1; 59 | } 60 | 61 | element.focus(); 62 | 63 | // Repositions the window on jump-to-anchor to account for header height. 64 | window.scrollBy( 0, -80 ); 65 | } 66 | } ); 67 | 68 | $( function() { 69 | // Search toggle. 70 | $( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) { 71 | var that = $( this ), 72 | wrapper = $( '#search-container' ), 73 | container = that.find( 'a' ); 74 | 75 | that.toggleClass( 'active' ); 76 | wrapper.toggleClass( 'hide' ); 77 | 78 | if ( that.hasClass( 'active' ) ) { 79 | container.attr( 'aria-expanded', 'true' ); 80 | } else { 81 | container.attr( 'aria-expanded', 'false' ); 82 | } 83 | 84 | if ( that.is( '.active' ) || $( '.search-toggle .screen-reader-text' )[0] === event.target ) { 85 | wrapper.find( '.search-field' ).focus(); 86 | } 87 | } ); 88 | 89 | /* 90 | * Fixed header for large screen. 91 | * If the header becomes more than 48px tall, unfix the header. 92 | * 93 | * The callback on the scroll event is only added if there is a header 94 | * image and we are not on mobile. 95 | */ 96 | if ( _window.width() > 781 ) { 97 | var mastheadHeight = $( '#masthead' ).height(), 98 | toolbarOffset, mastheadOffset; 99 | 100 | if ( mastheadHeight > 48 ) { 101 | body.removeClass( 'masthead-fixed' ); 102 | } 103 | 104 | if ( body.is( '.header-image' ) ) { 105 | toolbarOffset = body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0; 106 | mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset; 107 | 108 | _window.on( 'scroll.twentyfourteen', function() { 109 | if ( _window.scrollTop() > mastheadOffset && mastheadHeight < 49 ) { 110 | body.addClass( 'masthead-fixed' ); 111 | } else { 112 | body.removeClass( 'masthead-fixed' ); 113 | } 114 | } ); 115 | } 116 | } 117 | 118 | // Focus styles for menus. 119 | $( '.primary-navigation, .secondary-navigation' ).find( 'a' ).on( 'focus.twentyfourteen blur.twentyfourteen', function() { 120 | $( this ).parents().toggleClass( 'focus' ); 121 | } ); 122 | } ); 123 | 124 | /** 125 | * @summary Add or remove ARIA attributes. 126 | * Uses jQuery's width() function to determine the size of the window and add 127 | * the default ARIA attributes for the menu toggle if it's visible. 128 | * @since Twenty Fourteen 1.4 129 | */ 130 | function onResizeARIA() { 131 | if ( 781 > _window.width() ) { 132 | button.attr( 'aria-expanded', 'false' ); 133 | menu.attr( 'aria-expanded', 'false' ); 134 | button.attr( 'aria-controls', 'primary-menu' ); 135 | } else { 136 | button.removeAttr( 'aria-expanded' ); 137 | menu.removeAttr( 'aria-expanded' ); 138 | button.removeAttr( 'aria-controls' ); 139 | } 140 | } 141 | 142 | _window 143 | .on( 'load.twentyfourteen', onResizeARIA ) 144 | .on( 'resize.twentyfourteen', function() { 145 | onResizeARIA(); 146 | } ); 147 | 148 | _window.load( function() { 149 | // Arrange footer widgets vertically. 150 | if ( $.isFunction( $.fn.masonry ) ) { 151 | $( '#footer-sidebar' ).masonry( { 152 | itemSelector: '.widget', 153 | columnWidth: function( containerWidth ) { 154 | return containerWidth / 4; 155 | }, 156 | gutterWidth: 0, 157 | isResizable: true, 158 | isRTL: $( 'body' ).is( '.rtl' ) 159 | } ); 160 | } 161 | 162 | // Initialize Featured Content slider. 163 | if ( body.is( '.slider' ) ) { 164 | $( '.featured-content' ).featuredslider( { 165 | selector: '.featured-content-inner > article', 166 | controlsContainer: '.featured-content' 167 | } ); 168 | } 169 | } ); 170 | } )( jQuery ); 171 | -------------------------------------------------------------------------------- /themes/twentyfourteen/js/html5.js: -------------------------------------------------------------------------------- 1 | /* 2 | HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); 5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; 6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f); 8 | if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d 11 | 12 |
    13 | 14 | 20 | 21 |
    22 |
    23 | 27 | 28 |
    > 29 |

    ', '

    ' ); 31 | 32 | // Output the authors list. 33 | twentyfourteen_list_authors(); 34 | 35 | edit_post_link( __( 'Edit', 'twentyfourteen' ), '
    ', '
    ' ); 36 | ?> 37 |
    38 | 39 | 46 |
    47 |
    48 |
    49 | 50 | 11 | 12 |
    13 | 14 | 20 | 21 |
    22 |
    23 | 36 |
    37 |
    38 |
    39 | 40 | 15 | 16 |
    17 | 18 | 24 |
    25 |
    26 | 27 | 40 | 41 |
    42 |
    43 | 44 |
    45 | 46 | 11 | 12 |
    13 |
    14 | 15 | 16 | 17 | 20 | 21 | 42 | 43 |
    44 |
    45 | 46 | 14 | 17 | -------------------------------------------------------------------------------- /themes/twentyfourteen/sidebar-footer.php: -------------------------------------------------------------------------------- 1 | 14 | 15 |
    16 | 19 |
    20 | -------------------------------------------------------------------------------- /themes/twentyfourteen/sidebar.php: -------------------------------------------------------------------------------- 1 | 10 |
    11 | 15 |

    16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 28 | 29 |
    30 | -------------------------------------------------------------------------------- /themes/twentyfourteen/single.php: -------------------------------------------------------------------------------- 1 | 11 | 12 |
    13 |
    14 | 34 |
    35 |
    36 | 37 | 15 | 16 |
    17 |
    18 | 19 | 20 | 21 |
    22 |

    23 | 24 | %s
    ', $term_description ); 29 | endif; 30 | ?> 31 | 32 | 33 | 54 | 55 |
    56 | 57 | 20 | 21 |
    22 |
    23 | 24 | 25 | 26 |
    27 |

    28 | 55 |

    56 |
    57 | 58 | 79 |
    80 |
    81 | 82 |