Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] feat: harden post type usage and establish relationships between listings and posts/pages #43

Merged
merged 33 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d44cace
feat: make Business patterns applicable only to places
dkoo Feb 25, 2021
0a7a1cb
feat: create shadow taxonomy for places
dkoo Feb 25, 2021
c1f2c5e
Merge branch 'epic/phase-2' into feat/data-type-usage
dkoo Mar 19, 2021
c05c6c6
feat: add ability to associate Places with regular posts and pages
dkoo Mar 19, 2021
084dad5
Merge branch 'epic/phase-2' into feat/data-type-usage
dkoo Mar 30, 2021
87b3708
fix: remove default map markers from patterns
dkoo Mar 30, 2021
4d4d4b8
feat: new Price block for Marketplace listings
dkoo Mar 31, 2021
082cf5a
feat: add meta field with data synced from Price block
dkoo Mar 31, 2021
1177275
feat: second test pattern
dkoo Mar 31, 2021
54e3fde
fix: incorrect conditional for updating shadow terms (whoops)
dkoo Mar 31, 2021
5256dd2
feat: abstract shadow tax functions to make it easier to add more
dkoo Mar 31, 2021
023e37e
refactor: simplify setting formattedPrice attribute via useEffect
dkoo Mar 31, 2021
9c3f687
chore: fix PHP warning about passing variables
dkoo Mar 31, 2021
5c6bf0c
feat: shadow taxonomies for all CPTs; test automated related listings
dkoo Mar 31, 2021
caa1938
fix: avoid showing post on itself
dkoo Apr 5, 2021
f2d554c
fix: incorrect var assignment
dkoo Apr 5, 2021
621c497
fix: decode HTML entities before rendering currency options
dkoo Apr 5, 2021
a70feef
chore: fix function/class docs
dkoo Apr 5, 2021
9ae4141
fix: formatting an empty string results in NaN
dkoo Apr 5, 2021
d27b19a
fix: wrong post type being returned by util
dkoo Apr 5, 2021
a6f0195
fix: handle all listing post types for shadow taxonomies
dkoo Apr 5, 2021
a50068a
fix: don't show the shadow taxonomy for the post being edited
dkoo Apr 5, 2021
ce6aa70
feat: add new post button for shadow taxonomies
dkoo Apr 5, 2021
819dffe
chore: instantiate var as empty array, just in case
dkoo Apr 5, 2021
4f374be
fix: updating of terms, and delete orphan terms
dkoo Apr 8, 2021
15944a1
Merge branch 'epic/phase-2' into feat/data-type-usage
dkoo Apr 12, 2021
f2a88a2
fix: replace Material icon with WordPress icon
dkoo Apr 12, 2021
a1d033b
feat: custom UI for parent/child listings instead of WP taxonomy UI
dkoo Apr 16, 2021
a3978bd
chore: update function comment
dkoo Apr 22, 2021
df7843f
chore: remove commented-out code
dkoo Apr 22, 2021
527fe4d
fix: posts/pages child search fields; only show child UI if published
dkoo Apr 22, 2021
4b43a7c
fix: logical errors in validation method :facepalm:
dkoo Apr 23, 2021
a136170
chore: update function name and comments for clarity
dkoo Apr 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 42 additions & 30 deletions includes/class-newspack-listings-block-patterns.php

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions includes/class-newspack-listings-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public static function manage_editor_assets() {
'post_type_label' => get_post_type_object( $post_type )->labels->singular_name,
'post_type' => $post_type,
'post_types' => $post_types,
'currency' => function_exists( 'get_woocommerce_currency' ) ? get_woocommerce_currency() : __( 'USD', 'newspack-listings' ),
'currencies' => function_exists( 'get_woocommerce_currencies' ) ? get_woocommerce_currencies() : [ 'USD' => __( 'United States (US) dollar', 'newspack-listings' ) ],

// If we don't have ANY listings that can be added to a list yet, alert the editor so we can show messaging.
'no_listings' => 0 === $total_count,
Expand Down
23 changes: 23 additions & 0 deletions includes/class-newspack-listings-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,29 @@ public static function get_meta_fields( $post_type = null, $field_names_only = f
},
],
],
'newspack_listings_price' => [
'post_types' => [
self::NEWSPACK_LISTINGS_POST_TYPES['marketplace'],
],
'label' => __( 'Price', 'newspack-listings' ),
'source' => [
'blockName' => 'newspack-listings/price',
'attr' => 'price',
'single' => true,
],
'settings' => [
'object_subtype' => $post_type,
'default' => '',
'description' => __( 'Price for this listing.', 'newspack-listings' ),
'type' => 'string',
'sanitize_callback' => 'sanitize_text_field',
'single' => true,
'show_in_rest' => true,
'auth_callback' => function() {
return current_user_can( 'edit_posts' );
},
],
],
'newspack_listings_hide_author' => [
'post_types' => [
self::NEWSPACK_LISTINGS_POST_TYPES['event'],
Expand Down
Loading