WordPress.org

Forums

Custom Content Type Manager
Image Field - Having Problems with Search Parameters (2 posts)

  1. WebmistressM
    Member
    Posted 2 years ago #

    I have a custom content type that is set up with a few image fields. However, between all the articles and blog posts, the core media library is going to get big and unwieldy real quick.

    I know that the big thing they urge us to do is to configure the search parameters for a media, image or relation field. Relevant article contained below:

    http://code.google.com/p/wordpress-custom-content-type-manager/wiki/Config_post_selector_media

    however, upon trying this, I was unable to get CCTM to use the columns named in that file. Normally images do not get taxonomy features to them but I was trying to experiment with getting a bit more control on the situation by experimenting with the Media Tags and Media Assist plugin.

    Currently my wp-content/uploads/cctm/config/post_selector/_image.php file reads as such (copied from cctm's core _image.php file):

    <?php
    if ( ! defined('CCTM_PATH')) exit('No direct script access allowed');
    
    CCTM::$post_selector['search_columns'] = array('post_title', 'post_content', 'post_excerpt', 'name', 'meta_value');
    CCTM::$post_selector['post_type'] = 'attachment';
    CCTM::$post_selector['post_mime_type'] = 'image';
    CCTM::$post_selector['post_status'] = array('publish','inherit');
    CCTM::$post_selector['orderby'] = 'ID';
    CCTM::$post_selector['order'] = 'DESC';
    CCTM::$post_selector['limit'] = 10;
    CCTM::$post_selector['paginate'] = 1;
    /*EOF*/

    Its possible that Im going about this the wrong way as far as trying to use such plugins as Media Assist and Media Tags. I thought, at the very least, post_exerpt would work for me, allowing me to put a specific work in the caption of each image that would then be picked up by the specific search parameters of that image field. That would at least allow me to isolate only the photos I want to be "selectable" when people add images from our library into a field for that custom content type.

    Any advice on what I can do? I tried asking around and everyone suggests I go with NextGen gallery to organize my stuff into albums, with no knowledge that CCTM will not recognize photos uploaded with NextGEN

    http://wordpress.org/plugins/custom-content-type-manager/

  2. fireproofsocks
    Member
    Plugin Author

    Posted 2 years ago #

    You can configure searches in several ways -- the easiest way is to use the GUI and not edit the config files (the config files are for the geeks). When you create or edit a custom image field, click the button labeled "Set Search Parameters": that will let you define searches for a majority of use cases.

    If the GUI presented when defining a field is not sufficient, you can customize it using the configuration files (the elements on that search form are controlled by the config/search_parameters/_image.php file for example).

    If you wanted your image field to let users select images that had been tagged with certain tag or category, you could "open up" these elements in your search forms by adding the following lines to your copy of the _image.php file (placed inside the wp-content/uploads/cctm/config/search_parameters directory -- like a child theme, files in that location will override the ones in the plugin directory):

    // ... default search stuff above ...
    CCTM::$search_by[] = 'taxonomy';
    CCTM::$search_by[] = 'taxonomy_term';

    Then when you define/edit your custom field, you can specify which taxonomy and which term should be used when querying for images.

    I can't comment on the NextGEN gallery, but generally, WP users tend to think that plugins fix everything... but at some point it's like taking too many pills and the side-effects kill you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Content Type Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic