generated from pascalmartineau/wp-skeleton
refactor: membership => profile
All checks were successful
Deploy WordPress and Nuxt / deploy (push) Successful in 1m6s
All checks were successful
Deploy WordPress and Nuxt / deploy (push) Successful in 1m6s
This commit is contained in:
@@ -85,8 +85,8 @@ __( "Location", 'ccat' );
|
||||
__( "Location type", 'ccat' );
|
||||
__( "Media type", 'ccat' );
|
||||
__( "Media(s)", 'ccat' );
|
||||
__( "Membership type", 'ccat' );
|
||||
__( "Membership(s)", 'ccat' );
|
||||
__( "Profile type", 'ccat' );
|
||||
__( "Profile(s)", 'ccat' );
|
||||
__( "Message", 'ccat' );
|
||||
__( "Minimum price", 'ccat' );
|
||||
__( "Moral entity", 'ccat' );
|
||||
@@ -110,7 +110,7 @@ __( "Post – Article", 'ccat' );
|
||||
__( "Post – Contributor", 'ccat' );
|
||||
__( "Post – Event", 'ccat' );
|
||||
__( "Post – Location", 'ccat' );
|
||||
__( "Post – Membership", 'ccat' );
|
||||
__( "Post – Profile", 'ccat' );
|
||||
__( "Post – Page", 'ccat' );
|
||||
__( "Post – Project", 'ccat' );
|
||||
__( "Post – Representation", 'ccat' );
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"key": "group_post_membership",
|
||||
"title": "Post - Membership",
|
||||
"key": "group_post_profile",
|
||||
"title": "Post - Profile",
|
||||
"fields": [
|
||||
{
|
||||
"key": "field_68c85464c2413",
|
||||
@@ -525,8 +525,8 @@
|
||||
},
|
||||
{
|
||||
"key": "field_6855b1f1c65bf",
|
||||
"label": "Membership type",
|
||||
"name": "membership_type",
|
||||
"label": "Profile type",
|
||||
"name": "profile_type",
|
||||
"aria-label": "",
|
||||
"type": "select",
|
||||
"instructions": "",
|
||||
@@ -555,7 +555,7 @@
|
||||
"ui": 0,
|
||||
"show_in_graphql": 1,
|
||||
"graphql_description": "",
|
||||
"graphql_field_name": "membershipType",
|
||||
"graphql_field_name": "profileType",
|
||||
"graphql_non_null": 1,
|
||||
"ajax": 0,
|
||||
"placeholder": "",
|
||||
@@ -707,7 +707,7 @@
|
||||
{
|
||||
"param": "post_type",
|
||||
"operator": "==",
|
||||
"value": "membership"
|
||||
"value": "profile"
|
||||
}
|
||||
]
|
||||
],
|
||||
@@ -726,7 +726,7 @@
|
||||
"acfe_form": 0,
|
||||
"acfe_display_title": "",
|
||||
"show_in_graphql": 1,
|
||||
"graphql_field_name": "groupPostMembership",
|
||||
"graphql_field_name": "groupPostProfile",
|
||||
"map_graphql_types_from_location_rules": 0,
|
||||
"graphql_types": "",
|
||||
"acfe_meta": "",
|
||||
@@ -0,0 +1,3 @@
|
||||
fragment TheListing on Listing {
|
||||
title
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { TheMembershipFragment } from "#graphql-operations";
|
||||
import type { TheListingFragment } from "#graphql-operations";
|
||||
|
||||
const props = defineProps<TheMembershipFragment>();
|
||||
const props = defineProps<TheListingFragment>();
|
||||
useSeoMeta({ title: props.title });
|
||||
</script>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
fragment TheMembership on Membership {
|
||||
title
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fragment TheProfile on Profile {
|
||||
title
|
||||
}
|
||||
12
wp-content/themes/ccat/app/components/nodes/TheProfile.vue
Normal file
12
wp-content/themes/ccat/app/components/nodes/TheProfile.vue
Normal file
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { TheProfileFragment } from "#graphql-operations";
|
||||
|
||||
const props = defineProps<TheProfileFragment>();
|
||||
useSeoMeta({ title: props.title });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UPage>
|
||||
<UPageSection v-if="title" :title="title" />
|
||||
</UPage>
|
||||
</template>
|
||||
@@ -1,9 +1,10 @@
|
||||
import { ThePage, TheArticle, TheEvent, TheLocation, TheMembership, TheProject, TheResource } from "#components";
|
||||
import { ThePage, TheArticle, TheEvent, TheListing, TheLocation, TheProfile, TheProject, TheResource } from "#components";
|
||||
|
||||
const nodes = {
|
||||
Event: TheEvent,
|
||||
Location: TheLocation,
|
||||
Membership: TheMembership,
|
||||
Listing: TheListing,
|
||||
Profile: TheProfile,
|
||||
Page: ThePage,
|
||||
Post: TheArticle,
|
||||
Project: TheProject,
|
||||
|
||||
@@ -18,8 +18,8 @@ query nodeByUri($uri: String!) {
|
||||
... on Location {
|
||||
...TheLocation
|
||||
}
|
||||
... on Membership {
|
||||
...TheMembership
|
||||
... on Profile {
|
||||
...TheProfile
|
||||
}
|
||||
... on Project {
|
||||
...TheProject
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
require_once __DIR__ . '/includes/core/theme-setup.php';
|
||||
|
||||
// Custom Post Types
|
||||
require_once __DIR__ . '/includes/cpt/listing.php';
|
||||
require_once __DIR__ . '/includes/cpt/membership.php';
|
||||
require_once __DIR__ . '/includes/cpt/contributor.php';
|
||||
require_once __DIR__ . '/includes/cpt/event.php';
|
||||
require_once __DIR__ . '/includes/cpt/listing.php';
|
||||
require_once __DIR__ . '/includes/cpt/location.php';
|
||||
require_once __DIR__ . '/includes/cpt/profile.php';
|
||||
require_once __DIR__ . '/includes/cpt/project.php';
|
||||
require_once __DIR__ . '/includes/cpt/representation.php';
|
||||
require_once __DIR__ . '/includes/cpt/resource.php';
|
||||
|
||||
@@ -54,8 +54,8 @@ function ccat_listing_register_post_type() {
|
||||
'rest_base' => 'listing',
|
||||
'rest_controller_class' => 'WP_REST_Posts_Controller',
|
||||
'show_in_graphql' => true,
|
||||
'graphql_single_name' => "Annonce",
|
||||
'graphql_plural_name' => "Annonces",
|
||||
'graphql_single_name' => "Listing",
|
||||
'graphql_plural_name' => "Listings",
|
||||
'graphql_interfaces' => array( 'Node' ),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Register 'membership' post type
|
||||
add_action( 'init', 'ccat_membership_register_post_type' );
|
||||
function ccat_membership_register_post_type() {
|
||||
register_post_type(
|
||||
'membership',
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => __( "Memberships", 'ccat' ),
|
||||
'menu_name' => __( "Memberships", 'ccat' ),
|
||||
'singular_name' => __( "Membership", 'ccat' ),
|
||||
'add_new' => __( "Add New", 'ccat' ),
|
||||
'add_new_item' => __( "Add New Membership", 'ccat' ),
|
||||
'new_item' => __( "New Membership", 'ccat' ),
|
||||
'edit_item' => __( "Edit Membership", 'ccat' ),
|
||||
'view_item' => __( "View Membership", 'ccat' ),
|
||||
'view_items' => __( "View Memberships", 'ccat' ),
|
||||
'search_items' => __( "Search Memberships", 'ccat' ),
|
||||
'not_found' => __( "No Memberships found", 'ccat' ),
|
||||
'not_found_in_trash' => __( "No Memberships found in trash", 'ccat' ),
|
||||
'parent_item_colon' => __( "Parent Membership:", 'ccat' ),
|
||||
'all_items' => __( "All Memberships", 'ccat' ),
|
||||
'archives' => __( "Membership Archives", 'ccat' ),
|
||||
'attributes' => __( "Membership Attributes", 'ccat' ),
|
||||
'insert_into_item' => __( "Insert into Membership", 'ccat' ),
|
||||
'uploaded_to_this_item' => __( "Uploaded to this Membership", 'ccat' ),
|
||||
'featured_image' => __( "Featured Image", 'ccat' ),
|
||||
'set_featured_image' => __( "Set featured image", 'ccat' ),
|
||||
'remove_featured_image' => __( "Remove featured image", 'ccat' ),
|
||||
'use_featured_image' => __( "Use as featured image", 'ccat' ),
|
||||
'filter_items_list' => __( "Filter Memberships list", 'ccat' ),
|
||||
'items_list_navigation' => __( "Memberships list navigation", 'ccat' ),
|
||||
'items_list' => __( "Memberships list", 'ccat' ),
|
||||
'item_published' => __( "Membership published.", 'ccat' ),
|
||||
'item_published_privately' => __( "Membership published privately.", 'ccat' ),
|
||||
'item_reverted_to_draft' => __( "Membership reverted to draft.", 'ccat' ),
|
||||
'item_scheduled' => __( "Membership scheduled.", 'ccat' ),
|
||||
'item_updated' => __( "Membership updated.", 'ccat' ),
|
||||
),
|
||||
'public' => true,
|
||||
'hierarchical' => false,
|
||||
'show_ui' => true,
|
||||
'show_in_nav_menus' => false,
|
||||
'supports' => array( 'title', 'thumbnail', 'author', 'revisions' ),
|
||||
'has_archive' => false,
|
||||
'rewrite' => array(
|
||||
'slug' => 'membre',
|
||||
'with_front' => false,
|
||||
|
||||
),
|
||||
'query_var' => true,
|
||||
'menu_icon' => 'dashicons-id',
|
||||
'show_in_rest' => true,
|
||||
'rest_base' => 'membership',
|
||||
'rest_controller_class' => 'WP_REST_Posts_Controller',
|
||||
'show_in_graphql' => true,
|
||||
'graphql_single_name' => "Membership",
|
||||
'graphql_plural_name' => "Memberships",
|
||||
'graphql_interfaces' => array( 'Node' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Custom 'membership' post updated messages
|
||||
add_filter( 'post_updated_messages', 'ccat_membership_post_updated_messages' );
|
||||
function ccat_membership_post_updated_messages( $messages ) {
|
||||
global $post;
|
||||
$permalink = get_permalink( $post );
|
||||
$preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', esc_url( get_preview_post_link( $post ) ), __( "Preview Membership", 'ccat' ) );
|
||||
$scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', esc_url( $permalink ), __( "Preview Membership", 'ccat' ) );
|
||||
$scheduled_date = date_i18n( __( "M j, Y @ H:i", 'ccat' ), strtotime( $post->post_date ) );
|
||||
$view_post_link_html = sprintf( ' <a href="%1$s">%2$s</a>', esc_url( $permalink ), __( "View Membership", 'ccat' ) );
|
||||
$messages['membership'] = array(
|
||||
0 => '',
|
||||
1 => __( "Membership updated.", 'ccat' ) . $view_post_link_html,
|
||||
2 => __( "Custom field updated.", 'ccat' ),
|
||||
3 => __( "Custom field deleted.", 'ccat' ),
|
||||
4 => __( "Membership updated.", 'ccat' ),
|
||||
5 => isset( $_GET['revision'] ) ? sprintf( __( "Membership restored to revision from %s", 'ccat' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
||||
6 => __( "Membership published.", 'ccat' ) . $view_post_link_html,
|
||||
7 => __( "Membership saved.", 'ccat' ),
|
||||
8 => __( "Membership submitted.", 'ccat' ) . $preview_post_link_html,
|
||||
9 => sprintf( __( 'Membership scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
|
||||
10 => __( 'Membership draft updated.' ) . $preview_post_link_html,
|
||||
);
|
||||
|
||||
return $messages;
|
||||
}
|
||||
89
wp-content/themes/ccat/includes/cpt/profile.php
Normal file
89
wp-content/themes/ccat/includes/cpt/profile.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
// Register 'profile' post type
|
||||
add_action( 'init', 'ccat_profile_register_post_type' );
|
||||
function ccat_profile_register_post_type() {
|
||||
register_post_type(
|
||||
'profile',
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => __( "Profiles", 'ccat' ),
|
||||
'menu_name' => __( "Profiles", 'ccat' ),
|
||||
'singular_name' => __( "Profile", 'ccat' ),
|
||||
'add_new' => __( "Add New", 'ccat' ),
|
||||
'add_new_item' => __( "Add New Profile", 'ccat' ),
|
||||
'new_item' => __( "New Profile", 'ccat' ),
|
||||
'edit_item' => __( "Edit Profile", 'ccat' ),
|
||||
'view_item' => __( "View Profile", 'ccat' ),
|
||||
'view_items' => __( "View Profiles", 'ccat' ),
|
||||
'search_items' => __( "Search Profiles", 'ccat' ),
|
||||
'not_found' => __( "No Profiles found", 'ccat' ),
|
||||
'not_found_in_trash' => __( "No Profiles found in trash", 'ccat' ),
|
||||
'parent_item_colon' => __( "Parent Profile:", 'ccat' ),
|
||||
'all_items' => __( "All Profiles", 'ccat' ),
|
||||
'archives' => __( "Profile Archives", 'ccat' ),
|
||||
'attributes' => __( "Profile Attributes", 'ccat' ),
|
||||
'insert_into_item' => __( "Insert into Profile", 'ccat' ),
|
||||
'uploaded_to_this_item' => __( "Uploaded to this Profile", 'ccat' ),
|
||||
'featured_image' => __( "Featured Image", 'ccat' ),
|
||||
'set_featured_image' => __( "Set featured image", 'ccat' ),
|
||||
'remove_featured_image' => __( "Remove featured image", 'ccat' ),
|
||||
'use_featured_image' => __( "Use as featured image", 'ccat' ),
|
||||
'filter_items_list' => __( "Filter Profiles list", 'ccat' ),
|
||||
'items_list_navigation' => __( "Profiles list navigation", 'ccat' ),
|
||||
'items_list' => __( "Profiles list", 'ccat' ),
|
||||
'item_published' => __( "Profile published.", 'ccat' ),
|
||||
'item_published_privately' => __( "Profile published privately.", 'ccat' ),
|
||||
'item_reverted_to_draft' => __( "Profile reverted to draft.", 'ccat' ),
|
||||
'item_scheduled' => __( "Profile scheduled.", 'ccat' ),
|
||||
'item_updated' => __( "Profile updated.", 'ccat' ),
|
||||
),
|
||||
'public' => true,
|
||||
'hierarchical' => false,
|
||||
'show_ui' => true,
|
||||
'show_in_nav_menus' => false,
|
||||
'supports' => array( 'title', 'thumbnail', 'author', 'revisions' ),
|
||||
'has_archive' => false,
|
||||
'rewrite' => array(
|
||||
'slug' => 'profil',
|
||||
'with_front' => false,
|
||||
|
||||
),
|
||||
'query_var' => true,
|
||||
'menu_icon' => 'dashicons-id',
|
||||
'show_in_rest' => true,
|
||||
'rest_base' => 'profile',
|
||||
'rest_controller_class' => 'WP_REST_Posts_Controller',
|
||||
'show_in_graphql' => true,
|
||||
'graphql_single_name' => "Profile",
|
||||
'graphql_plural_name' => "Profiles",
|
||||
'graphql_interfaces' => array( 'Node' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Custom 'profile' post updated messages
|
||||
add_filter( 'post_updated_messages', 'ccat_profile_post_updated_messages' );
|
||||
function ccat_profile_post_updated_messages( $messages ) {
|
||||
global $post;
|
||||
$permalink = get_permalink( $post );
|
||||
$preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', esc_url( get_preview_post_link( $post ) ), __( "Preview Profile", 'ccat' ) );
|
||||
$scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', esc_url( $permalink ), __( "Preview Profile", 'ccat' ) );
|
||||
$scheduled_date = date_i18n( __( "M j, Y @ H:i", 'ccat' ), strtotime( $post->post_date ) );
|
||||
$view_post_link_html = sprintf( ' <a href="%1$s">%2$s</a>', esc_url( $permalink ), __( "View Profile", 'ccat' ) );
|
||||
$messages['profile'] = array(
|
||||
0 => '',
|
||||
1 => __( "Profile updated.", 'ccat' ) . $view_post_link_html,
|
||||
2 => __( "Custom field updated.", 'ccat' ),
|
||||
3 => __( "Custom field deleted.", 'ccat' ),
|
||||
4 => __( "Profile updated.", 'ccat' ),
|
||||
5 => isset( $_GET['revision'] ) ? sprintf( __( "Profile restored to revision from %s", 'ccat' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
||||
6 => __( "Profile published.", 'ccat' ) . $view_post_link_html,
|
||||
7 => __( "Profile saved.", 'ccat' ),
|
||||
8 => __( "Profile submitted.", 'ccat' ) . $preview_post_link_html,
|
||||
9 => sprintf( __( 'Profile scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
|
||||
10 => __( 'Profile draft updated.' ) . $preview_post_link_html,
|
||||
);
|
||||
|
||||
return $messages;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user