Skip to content

Commit 136299e

Browse files
authored
Setup and working version (#1)
* chore: 🏗️ Set up npm and composer, scaffold files * edits to plugin header * re-organize files * include `shortcodes.php` * Add shortcodes to file. * Edit typo * Move code from Sandbox plugin * add ACF JSON * Remove Social Media Directory CPT and Group * Add namespace to function * Add and Enqueue templates * Remove templates. Not needed. Remove custom search block variation. Not needed. Edit `package.json`. * Edit package.json * Github release workflow
1 parent 2c17973 commit 136299e

17 files changed

Lines changed: 23735 additions & 2 deletions

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
charset = utf-8
7+
trim_trailing_whitespace = false
8+
insert_final_newline = false

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build and release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
- 'v*.*.*-rc.*'
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
# - uses: actions/setup-node@v3.3.0
19+
# with:
20+
# node-version: 20
21+
# cache: 'npm'
22+
23+
- name: Install Node dependencies
24+
run: npm install
25+
26+
- name: Package plugin
27+
run: ./node_modules/.bin/wp-scripts plugin-zip
28+
29+
- name: Release
30+
uses: softprops/action-gh-release@v1
31+
with:
32+
files: ucsc-communications-functionality-plugin.zip
33+
generate_release_notes: true

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ wp-config.php
4545
#
4646
# Note: If you wish to whitelist themes,
4747
# uncomment the next line
48-
#/wp-content/themes
48+
#/wp-content/themes
49+
node_modules/
50+
/vendor/

.phpcs.xml.dist

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Example Project" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
3+
4+
<description>A custom set of rules to check for a WPized WordPress project</description>
5+
6+
<!-- Exclude WP Core folders and files from being checked. -->
7+
<exclude-pattern>/docroot/wp-admin/*</exclude-pattern>
8+
<exclude-pattern>/docroot/wp-includes/*</exclude-pattern>
9+
<exclude-pattern>/docroot/wp-*.php</exclude-pattern>
10+
<exclude-pattern>/docroot/index.php</exclude-pattern>
11+
<exclude-pattern>/docroot/xmlrpc.php</exclude-pattern>
12+
<exclude-pattern>/docroot/wp-content/plugins/*</exclude-pattern>
13+
14+
<!-- Exclude the Composer Vendor directory. -->
15+
<exclude-pattern>/vendor/*</exclude-pattern>
16+
17+
<!-- Exclude the Node Modules directory. -->
18+
<exclude-pattern>/node_modules/*</exclude-pattern>
19+
20+
<!-- Exclude minified Javascript files. -->
21+
<exclude-pattern>*.min.js</exclude-pattern>
22+
23+
<!-- Include the WordPress-Extra standard. -->
24+
<rule ref="WordPress-Extra">
25+
<!--
26+
We may want a middle ground though. The best way to do this is add the
27+
entire ruleset, then rule by rule, remove ones that don't suit a project.
28+
We can do this by running `phpcs` with the '-s' flag, which allows us to
29+
see the names of the sniffs reporting errors.
30+
Once we know the sniff names, we can opt to exclude sniffs which don't
31+
suit our project like so.
32+
33+
The below two examples just show how you can exclude rules.
34+
They are not intended as advice about which sniffs to exclude.
35+
-->
36+
37+
<!--
38+
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing"/>
39+
<exclude name="WordPress.Security.EscapeOutput"/>
40+
-->
41+
</rule>
42+
43+
<!-- Let's also check that everything is properly documented. -->
44+
<rule ref="WordPress-Docs"/>
45+
46+
<!-- Add in some extra rules from other standards. -->
47+
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
48+
<rule ref="Generic.Commenting.Todo"/>
49+
50+
<!-- Check for PHP cross-version compatibility. -->
51+
<!--
52+
To enable this, the PHPCompatibilityWP standard needs
53+
to be installed.
54+
See the readme for installation instructions:
55+
https://github.com/PHPCompatibility/PHPCompatibilityWP
56+
For more information, also see:
57+
https://github.com/PHPCompatibility/PHPCompatibility
58+
-->
59+
<!--
60+
<config name="testVersion" value="5.2-"/>
61+
<rule ref="PHPCompatibilityWP"/>
62+
-->
63+
64+
<!--
65+
To get the optimal benefits of using WPCS, we should add a couple of
66+
custom properties.
67+
Adjust the values of these properties to fit our needs.
68+
69+
For information on additional custom properties available, check out
70+
the wiki:
71+
https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
72+
-->
73+
<config name="minimum_supported_wp_version" value="4.9"/>
74+
75+
<rule ref="WordPress.WP.I18n">
76+
<properties>
77+
<property name="text_domain" type="array">
78+
<element value="ucscgiving"/>
79+
<!-- <element value="library-textdomain"/> -->
80+
</property>
81+
</properties>
82+
</rule>
83+
84+
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
85+
<properties>
86+
<property name="prefixes" type="array">
87+
<element value="ucscgiving"/>
88+
</property>
89+
</properties>
90+
</rule>
91+
92+
</ruleset>

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
# ucsc-communications-functionality
2-
Custom Functionality Plugin for UCSC's Communications website on the CampusPress network
2+
3+
Custom Functionality Plugin for UCSC's Communications website on the CampusPress network.
4+
5+
This plugin currently provides two short codes:
6+
7+
- `[style-definition]`: Displays the style definitions for each Editorial Style Guide post type
8+
- `[style-archive]`: Displays a loop of the style guide posts on the Editorial Style Guide page
9+
10+
This plugin also saves and loads ACF field groups to and from the plugin's `acf-json` folder.

acf-json/group_5a1f2f21b2d3c.json

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"key": "group_5a1f2f21b2d3c",
3+
"title": "A-Z Editorial Style Guide",
4+
"fields": [
5+
{
6+
"key": "field_5a1f2f21dd284",
7+
"label": "Style Definitions",
8+
"name": "style_definitions",
9+
"aria-label": "",
10+
"type": "repeater",
11+
"instructions": "Enter editorial style definitions below.",
12+
"required": 0,
13+
"conditional_logic": 0,
14+
"wrapper": {
15+
"width": "",
16+
"class": "",
17+
"id": ""
18+
},
19+
"collapsed": "",
20+
"min": 0,
21+
"max": 0,
22+
"layout": "table",
23+
"button_label": "Add Row",
24+
"rows_per_page": 20,
25+
"sub_fields": [
26+
{
27+
"key": "field_5a1f2f2203937",
28+
"label": "Editorial Style Item",
29+
"name": "editorial_style_item",
30+
"aria-label": "",
31+
"type": "text",
32+
"instructions": "Enter editorial style item name here.",
33+
"required": 0,
34+
"conditional_logic": 0,
35+
"wrapper": {
36+
"width": "",
37+
"class": "",
38+
"id": ""
39+
},
40+
"default_value": "",
41+
"placeholder": "",
42+
"prepend": "",
43+
"append": "",
44+
"maxlength": "",
45+
"parent_repeater": "field_5a1f2f21dd284"
46+
},
47+
{
48+
"key": "field_5a1f2f22039c1",
49+
"label": "Editorial Style Definition",
50+
"name": "editorial_style_definition",
51+
"aria-label": "",
52+
"type": "wysiwyg",
53+
"instructions": "Enter the style guide definition here.",
54+
"required": 0,
55+
"conditional_logic": 0,
56+
"wrapper": {
57+
"width": "",
58+
"class": "",
59+
"id": ""
60+
},
61+
"default_value": "",
62+
"tabs": "all",
63+
"toolbar": "full",
64+
"media_upload": 1,
65+
"delay": 0,
66+
"parent_repeater": "field_5a1f2f21dd284"
67+
}
68+
]
69+
}
70+
],
71+
"location": [
72+
[
73+
{
74+
"param": "post_type",
75+
"operator": "==",
76+
"value": "a_z_style_guide"
77+
}
78+
]
79+
],
80+
"menu_order": 5,
81+
"position": "normal",
82+
"style": "default",
83+
"label_placement": "top",
84+
"instruction_placement": "label",
85+
"hide_on_screen": "",
86+
"active": true,
87+
"description": "",
88+
"show_in_rest": 0,
89+
"modified": 1750961277
90+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"key": "post_type_685d7e97c87c6",
3+
"title": "Editorial Style Guide",
4+
"menu_order": 0,
5+
"active": true,
6+
"post_type": "a_z_style_guide",
7+
"advanced_configuration": true,
8+
"import_source": "",
9+
"import_date": "",
10+
"labels": {
11+
"name": "Editorial Style Guide",
12+
"singular_name": "Editorial Style Guide Entry",
13+
"menu_name": "A-Z Ed Style Guide",
14+
"all_items": "All Editorial Style Guide",
15+
"edit_item": "Edit Editorial Style Guide Entry",
16+
"view_item": "View Editorial Style Guide Entry",
17+
"view_items": "View Editorial Style Guide",
18+
"add_new_item": "Add New Editorial Style Guide Entry",
19+
"add_new": "Add New Editorial Style Guide Entry",
20+
"new_item": "New Editorial Style Guide Entry",
21+
"parent_item_colon": "Parent Editorial Style Guide Entry:",
22+
"search_items": "Search Editorial Style Guide",
23+
"not_found": "No editorial style guide found",
24+
"not_found_in_trash": "No editorial style guide found in Trash",
25+
"archives": "Editorial Style Guide Entry Archives",
26+
"attributes": "Editorial Style Guide Entry Attributes",
27+
"featured_image": "",
28+
"set_featured_image": "",
29+
"remove_featured_image": "",
30+
"use_featured_image": "",
31+
"insert_into_item": "Insert into editorial style guide entry",
32+
"uploaded_to_this_item": "Uploaded to this editorial style guide entry",
33+
"filter_items_list": "Filter editorial style guide list",
34+
"filter_by_date": "Filter editorial style guide by date",
35+
"items_list_navigation": "Editorial Style Guide list navigation",
36+
"items_list": "Editorial Style Guide list",
37+
"item_published": "Editorial Style Guide Entry published.",
38+
"item_published_privately": "Editorial Style Guide Entry published privately.",
39+
"item_reverted_to_draft": "Editorial Style Guide Entry reverted to draft.",
40+
"item_scheduled": "Editorial Style Guide Entry scheduled.",
41+
"item_updated": "Editorial Style Guide Entry updated.",
42+
"item_link": "Editorial Style Guide Entry Link",
43+
"item_link_description": "A link to a editorial style guide entry."
44+
},
45+
"description": "",
46+
"public": true,
47+
"hierarchical": false,
48+
"exclude_from_search": false,
49+
"publicly_queryable": true,
50+
"show_ui": true,
51+
"show_in_menu": true,
52+
"admin_menu_parent": "",
53+
"show_in_admin_bar": true,
54+
"show_in_nav_menus": true,
55+
"show_in_rest": true,
56+
"rest_base": "",
57+
"rest_namespace": "wp\/v2",
58+
"rest_controller_class": "WP_REST_Posts_Controller",
59+
"menu_position": 20,
60+
"menu_icon": {
61+
"type": "dashicons",
62+
"value": "dashicons-art"
63+
},
64+
"rename_capabilities": false,
65+
"singular_capability_name": "post",
66+
"plural_capability_name": "posts",
67+
"supports": [
68+
"title",
69+
"editor",
70+
"custom-fields"
71+
],
72+
"taxonomies": "",
73+
"has_archive": true,
74+
"has_archive_slug": "a-z-style-guide",
75+
"rewrite": {
76+
"permalink_rewrite": "post_type_key",
77+
"with_front": "1",
78+
"feeds": "0",
79+
"pages": "1"
80+
},
81+
"query_var": "post_type_key",
82+
"query_var_name": "",
83+
"can_export": true,
84+
"delete_with_user": false,
85+
"register_meta_box_cb": "",
86+
"enter_title_here": "",
87+
"modified": 1752851486
88+
}

composer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "ucsc/ucsc-communications-functionality",
3+
"description": "UCSC Comms Functionality",
4+
"type": "project",
5+
6+
"require-dev": {
7+
"dealerdirect/phpcodesniffer-composer-installer": "^1.1",
8+
"wp-coding-standards/wpcs": "^3.1"
9+
},
10+
"scripts": {
11+
"lint": "./vendor/bin/phpcs",
12+
"lint-fix": "./vendor/bin/phpcbf --extensions=php ."
13+
},
14+
"config": {
15+
"allow-plugins": {
16+
"dealerdirect/phpcodesniffer-composer-installer": true
17+
}
18+
},
19+
"autoload": {
20+
"psr-4": {
21+
"UCSC\\UcscCommunicationsFunctionality\\": "src/"
22+
}
23+
},
24+
"authors": [
25+
{
26+
"name": "Jason Chafin",
27+
"email": "1000543+Herm71@users.noreply.github.com"
28+
}
29+
]
30+
}

0 commit comments

Comments
 (0)