Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #26 from alleyinteractive/fields-filtering
Browse files Browse the repository at this point in the history
Fields filtering
  • Loading branch information
joshkadis committed Jan 21, 2016
2 parents e161160 + b15e66e commit 0b4b868
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 125 deletions.
6 changes: 0 additions & 6 deletions .scaffold

This file was deleted.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@ See `Sponsorship_Manager_Archiveless::posts_where()` for more info.
| `$hide` | `bool` | Return `true` to hide archiveless posts for this `$query`, or `false` to show them. |
| `$query` | `WP_Query` | Current query object |

### sponsorship_manager_post_fields

Applied to child fields in the `sponsorship-info` Fieldmanager Group for posts in enabled post types

| Param | Type | Description |
|-------|------|-------------|
| `$fields` | `array` | See `inc/fields.php` |

### sponsorship_manager_term_fields

Applied to child fields in the `sponsorship-campaign-display` Fieldmanager Group for terms in the `sponsorship_campaign` taxonomy

| Param | Type | Description |
|-------|------|-------------|
| `$fields` | `array` | See `inc/fields.php` |

## Examples

Expand Down
12 changes: 4 additions & 8 deletions inc/fields.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?php


/* begin fm:tax_sponsorship_campaign:sponsorship-campaign-display */
/**
* `sponsorship-campaign-display` Fieldmanager fields.
*/
function sponsorship_manager_fm_tax_sponsorship_campaign_sponsorship_campaign_display() {
$fm = new Fieldmanager_Group( array(
'name' => 'sponsorship-campaign-display',
'children' => array(
'children' => apply_filters( 'sponsorship_manager_term_fields', array(
'logo-primary' => new Fieldmanager_Media( __( 'Primary Logo', 'sponsorship-manager' ) ),
'logo-secondary' => new Fieldmanager_Media( __( 'Secondary Logo', 'sponsorship-manager' ) ),
'featured-image' => new Fieldmanager_Media( __( 'Campaign Featured Image', 'sponsorship-manager' ) ),
Expand Down Expand Up @@ -42,21 +41,19 @@ function sponsorship_manager_fm_tax_sponsorship_campaign_sponsorship_campaign_di
'description' => __( 'Use a phrase clearly indicating that this is a paid advertisement.', 'sponsorship-manager' ),
) ),
'richdescription' => new Fieldmanager_RichTextArea( __( 'Campaign Description', 'sponsorship-manager' ) ),
),
) ),
) );
$fm->add_term_form( __( 'Display Fields', 'sponsorship-manager' ), array( 'sponsorship_campaign' ) );
}
add_action( 'fm_term_sponsorship_campaign', 'sponsorship_manager_fm_tax_sponsorship_campaign_sponsorship_campaign_display' );
/* end fm:tax_sponsorship_campaign:sponsorship-campaign-display */

/* begin fm:sponsorship-info */
/**
* `sponsorship-info` Fieldmanager fields.
*/
function sponsorship_manager_fm_sponsorship_info() {
$fm = new Fieldmanager_Group( array(
'name' => 'sponsorship-info',
'children' => array(
'children' => apply_filters( 'sponsorship_manager_post_fields', array(
'sponsorship-campaign' => new Fieldmanager_Select( array(
'label' => __( 'Select Campaign', 'sponsorship-manager' ),
'first_empty' => true,
Expand All @@ -73,14 +70,13 @@ function sponsorship_manager_fm_sponsorship_info() {
'description' => __( "Use this field to override default DFP pixel URL. Include 'c' parameter; cache busting will be handled on output.", 'sponsorship-manager' ),
) ),
'archiveless' => new Fieldmanager_Checkbox( __( 'Hide from standard frontend queries (Recent Posts, author archive, etc.) and RSS feeds', 'sponsorship-manager' ) ),
),
) ),
) );
$fm->add_meta_box( __( 'Sponsorship Campaign', 'sponsorship-manager' ), sponsorship_manager()->get_enabled_post_types() );
}
foreach ( sponsorship_manager()->get_enabled_post_types() as $post_type ) {
add_action( 'fm_post_' . $post_type, 'sponsorship_manager_fm_sponsorship_info' );
}
/* end fm:sponsorship-info */

/**
* Render fallback Sponsorship Campaigns meta box if taxonomy is empty
Expand Down
4 changes: 0 additions & 4 deletions scaffold/config.json

This file was deleted.

32 changes: 0 additions & 32 deletions scaffold/fields/sponsorship-info.json

This file was deleted.

75 changes: 0 additions & 75 deletions scaffold/taxonomies/sponsorship_campaign.json

This file was deleted.

0 comments on commit 0b4b868

Please sign in to comment.