Community Forums › Forums › Archived Forums › Design Tips and Tricks › Custom Post Types by Taxonomy
- This topic has 1 reply, 1 voice, and was last updated 10 years, 3 months ago by
BrandonPDuncan.
-
AuthorPosts
-
September 4, 2013 at 10:35 am #60659
BrandonPDuncan
ParticipantMornin' all!
I'm trying to accomplish a filter/CPT of sorts inside of AgentPress and AgentPress Listings. Essentially, I want to create three custom listings:
Eateries, Events, and Destinations.
The issue is not setting the types, it's getting the correct "details" to show.
Since categories are not set with the listings, I thought I could use the following, since the "type" of place is a custom taxonomy:
function agentpress_property_details_filter( $details ) {
if ( !taxonomy_exists('29'))
$details['col1'] = array(
__( 'Cost:', 'apl' ) => '_listing_price',
__( 'Address:', 'apl' ) => '_listing_address',
__( 'City:', 'apl' ) => '_listing_city',
__( 'State:', 'apl' ) => '_listing_state',
__( 'ZIP:', 'apl' ) => '_listing_zip'
);
$details['col2'] = array(
__( 'Cuisine:', 'apl' ) => '_listing_mls',
__( 'Reservations needed?', 'apl' ) => '_listing_sqft',
__( 'Bedrooms:', 'apl' ) => '_listing_bedrooms',
__( 'Bathrooms:', 'apl' ) => '_listing_bathrooms',
__( 'Basement:', 'apl' ) => '_listing_basement'
);if ( taxonomy_exists('29'))
$details['col1'] = array(
__( 'Stuff:', 'apl' ) => '_listing_price',
__( 'Address:', 'apl' ) => '_listing_address',
__( 'City:', 'apl' ) => '_listing_city',
__( 'State:', 'apl' ) => '_listing_state',
__( 'ZIP:', 'apl' ) => '_listing_zip'
);
$details['col2'] = array(
__( 'MLS #:', 'apl' ) => '_listing_mls',
__( 'Square Feet:', 'apl' ) => '_listing_sqft',
__( 'Bedrooms:', 'apl' ) => '_listing_bedrooms',
__( 'Bathrooms:', 'apl' ) => '_listing_bathrooms',
__( 'Basement:', 'apl' ) => '_listing_basement'
);return $details;
}Notice in the code that if the Taxonomy ID is 29 for "eatery", I want to change the details to restaurant-ish details, but when it is a destination or event, they will be tailored to those kinds of places.
It works fine when I set the !taxonomy_exists, but not when it IS that taxonomy. I have also tried the alphabetical taxonomy instead of the Tax ID, but get the same result. Is there another way to filter this?
It should be an easy "if" function/array, but without categories, I'm stuck on how to set it. Especially since is_taxonomy is deprecated.Any suggestions besides paying $1,200 for custom coding?
Thanks!
http://DadsRoundTable.com/writeonetheroadSeptember 5, 2013 at 5:47 am #60806BrandonPDuncan
ParticipantSorry, the site is http://dadsroundtable.com/writeontheroad. There's nothing really there yet, however. I'm just starting the structure.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.