Skip to content

Commit adf6e8e

Browse files
Initial Release (pr #9 from /dev)
Update to v0.1 - Initial Release
2 parents b4fabfd + 4197a17 commit adf6e8e

137 files changed

Lines changed: 12384 additions & 675 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
assets/.DS_Store
2+
assets/inc/.DS_Store
3+
.DS_Store

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
## [0.1] - 2023-03-15
5+
### Initial commit

LICENSE

Lines changed: 21 additions & 674 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
# p0-plugin
1+
# Legend has it ...
2+
Long ago, in the before times (about 2019), a young Mage skilled in the craft of Pressing Words became aware of others looking to embark on the journey of learning this powerful magicks. He sought to create an aide, a guide for beginners taking their first steps on the path to their development. This guide became known as "Project Zero" and would grow and evolve to respect and hold true two of the Prime Dieties: Sehanine, the Moonweaver; and Avandra, the Changebringer.
3+
4+
[![GitHub license](https://img.shields.io/github/license/cocodedesigns/pzero-plugin?style=for-the-badge)](https://raw.githubusercontent.com/cocodedesigns/pzero-plugin/master/LICENSE.md)
5+
![GitHub release](https://img.shields.io/github/release/cocodedesigns/pzero-plugin?style=for-the-badge)
6+
7+
## New name, who dis?
8+
What started as a quick beginner theme for me to spin up for a client project has now become a standalone project to help other WordPress developers to create themes quickly. Project Zero now comprises of a theme and a plugin which can work together and utilise a number of WordPress best practices. It is from the most recent build of the theme that the plugin was spawned.
9+
10+
The plugin is named after "Avandra", the Goddess of freedom, travel, adventure, and luck. Adding plugins does come fraught with issues, but the whole system is built on the premise of freedom, and plugins are one of the best mechanisms to exercise that freedom to build your own site.
11+
12+
"Avandra" has been built to work best with WordPress 6.0 and above, but most of the features can be used in lower versions. It is recommended that you use the latest version of WordPress for your site for security purposes, and every measure has been taken to prevent as many conflicts as possible.
13+
14+
The theme goes under the name of "Sehanine", after the Moonweaver deity from Dungeons and Dragons. She has been used in the liveplay stream Critical Role and is the Goddess of illusion and misdirection, appearing in a number of forms as fits her purpose. She's probably the best deity to name a theme after, since the purpose of a theme is to create a new image for your site as you see fit.
15+
16+
You can fork both of these projects as you wish and use them to build your own site. Some planned elements have been moved to the plugin for best practices, and both are free to fork and develop as your own projects. They are released under the [GNU General Public License version 3](https://www.gnu.org/licenses/gpl-3.0.en.html), which should be maintained for your own projects. This makes the plugin compatible with WordPress, which was released under the [GNU General Public License version 2 or later](https://www.gnu.org/licenses/gpl-2.0.en.html).
17+
18+
Since this theme is a standalone project to help you become a developer, it comes without direct support. However, there are plenty of resources available, should you need them, and continually developing documentation is available at [nathanhawkes.co.uk/project-zero/](https://www.nathanhawkes.co.uk/project-zero/). You can also use the [WordPress Codex]([https://](https://developer.wordpress.org/reference/)) to find out more information about the functions in the theme.
19+
20+
## Contributions
21+
This theme has been created with thanks to a number of different projects. These projects include:
22+
23+
* [WordPress, of course](https://wordpress.org/)
24+
* [TGM Plugin Activation](http://tgmpluginactivation.com/)
25+
* [WP Admin Notification](https://github.com/askupasoftware/wp-admin-notification/)
26+
* [Plugin and Theme Update Checker](https://github.com/YahnisElsts/plugin-update-checker/)
27+
28+
This means that this theme can be shared and ported over to different websites, including commercial websites. Other works and plugins used as part of this theme are licensed under their own agreements.
29+
30+
To see a log of all the updates made to this theme, view the CHANGELOG. We recommend maintaining a CHANGELOG file for your own theme so you can keep track of changes you have made. This will also show your client what progress you have made on work.

assets/banner-1544x500.png

71 KB
Loading

assets/banner-772x250.png

27.4 KB
Loading

assets/css/styles.css

Whitespace-only changes.

assets/icon-128x128.png

2.02 KB
Loading

assets/icon-256x256.png

3.96 KB
Loading

assets/inc/cpts/custom-metabox.php

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?php
2+
add_action( 'add_meta_boxes_portfolio', 'myTheme_customMetabox' );
3+
4+
function myTheme_customMetabox() {
5+
6+
add_meta_box(
7+
'mytheme_metabox', // metabox ID
8+
'Meta Box', // title
9+
'myTheme_metaboxCB', // callback function
10+
'portfolio', // add meta box to custom post type (or post types in array)
11+
'normal', // position (normal, side, advanced)
12+
'default', // priority (default, low, high, core)
13+
/* array(
14+
'__back_compat_meta_box' => false,
15+
'__block_editor_compatible_meta_box' => true
16+
) */
17+
);
18+
19+
}
20+
21+
// it is a callback function which actually displays the content of the meta box
22+
function myTheme_metaboxCB( $post ){
23+
24+
$client_name = get_post_meta( $post->ID, 'client_name', true );
25+
$client_url = get_post_meta( $post->ID, 'client_url', true );
26+
$is_external = get_post_meta( $post->ID, 'is_external', true );
27+
$nofollow = get_post_meta( $post->ID, 'nofollow', true );
28+
$noindex = get_post_meta( $post->ID, 'noindex', true );
29+
30+
wp_nonce_field( 'project_zero', '_zerononce' );
31+
32+
echo '<table class="form-table">
33+
<tbody>
34+
<tr>
35+
<th><label for="client_name">Client name:</label></th>
36+
<td><input type="text" id="client_name" name="client_name" value="' . esc_attr( $client_name ) . '" class="regular-text"></td>
37+
</tr>
38+
<tr>
39+
<th><label for="client_url">Website URL:</label></th>
40+
<td><input type="text" id="client_url" name="client_url" value="' . esc_attr( $client_url ) . '" class="regular-text"></td>
41+
</tr>
42+
<tr>
43+
<th><label for="is_external">Open in new window/tab:</label></th>
44+
<td>
45+
<select id="is_external" name="is_external">
46+
<option value="_self" ' . selected( '_self', $is_external, false ) . '>Open in the current window/tab</option>
47+
<option value="_blank" ' . selected( '_blank', $is_external, false ) . '>Open in a new window/tab</option>
48+
</select>
49+
</td>
50+
</tr>
51+
<tr>
52+
<th><label for="nofollow">Add nofollow:</label></th>
53+
<td><input type="checkbox" name="nofollow" value="1" ' . checked( $nofollow, 1, false ) . ' /></td>
54+
</tr>
55+
<tr>
56+
<th><label for="noindex">Add noindex:</label></th>
57+
<td><input type="checkbox" name="noindex" value="1" ' . checked( $noindex, 1, false ) . ' /></td>
58+
</tr>
59+
</tbody>
60+
</table>';
61+
62+
}
63+
64+
add_action( 'save_post_portfolio', 'myTheme_saveMetaData', 10, 2 );
65+
66+
function myTheme_saveMetaData( $post_id, $post ) {
67+
68+
// nonce check
69+
if ( ! isset( $_POST[ '_zerononce' ] ) || ! wp_verify_nonce( $_POST[ '_zerononce' ], 'project_zero' ) ) {
70+
return $post_id;
71+
}
72+
73+
// check current user permissions
74+
$post_type = get_post_type_object( $post->post_type );
75+
76+
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
77+
return $post_id;
78+
}
79+
80+
// Do not save the data if autosave
81+
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {
82+
return $post_id;
83+
}
84+
85+
if( isset( $_POST[ 'client_name' ] ) ) {
86+
update_post_meta( $post_id, 'client_name', sanitize_text_field( $_POST[ 'client_name' ] ) );
87+
} else {
88+
delete_post_meta( $post_id, 'client_name' );
89+
}
90+
if( isset( $_POST[ 'client_url' ] ) ) {
91+
update_post_meta( $post_id, 'client_url', sanitize_text_field( $_POST[ 'client_url' ] ) );
92+
} else {
93+
delete_post_meta( $post_id, 'client_url' );
94+
}
95+
if( isset( $_POST[ 'is_external' ] ) ) {
96+
update_post_meta( $post_id, 'is_external', $_POST[ 'is_external' ] );
97+
} else {
98+
delete_post_meta( $post_id, 'is_external' );
99+
}
100+
if( isset( $_POST[ 'nofollow' ] ) ) {
101+
update_post_meta( $post_id, 'nofollow', $_POST[ 'nofollow' ] );
102+
} else {
103+
delete_post_meta( $post_id, 'nofollow' );
104+
}
105+
if( isset( $_POST[ 'noindex' ] ) ) {
106+
update_post_meta( $post_id, 'noindex', $_POST[ 'noindex' ] );
107+
} else {
108+
delete_post_meta( $post_id, 'noindex' );
109+
}
110+
111+
return $post_id;
112+
113+
}

0 commit comments

Comments
 (0)