[wp-hackers] Database Object Retrieval

Angelia Baladon angelia at 10sexyapples.com
Sat Jul 17 22:53:16 UTC 2010


I'm wondering if anyone has an answer to a scenario that I am trying to
resolve, and haven't found any solutions for.

I have a custom post/content type called "lesson"

I have multiple custom taxonomies registered to this custom post/content
type in order to allow for filtering the lessons by art subject, academic
subject etc.

I also have (link/url/bookmark) resources that need to be assigned to these
same taxonomies in order to allow for a related resource area on the lesson.
The relations will be created by the shared taxonomies.

I had originally hand coded all of my custom content registrations and such,
but, decided that it would be best to use one of the plugins that was being
developed to handle this, so that there would be a gui in the back end.
After much research, I went with CMS Press. I was able to work with the
code, adjusting and updating it as development was being completed on 3.0,
but, now I've hit a wall.

In the code ( the add or edit taxonomy form area ), the list of object types
to select from (for registering the taxonomy for) is being created
dynamically with a for each ( get_post_types public = true ) statement. This
of course does not create an option to register a taxonomy for the link
object type.

I really don't want to have to back six months worth of work out of CMS
Press and hand code it again on my own so that I will be able to relate a
taxonomy to a link object type, so, I need to find a solution to this.

I'm thinking there should be a function call for objects that is not
exclusive to the posts table in the database. I've seen get_object_types
used, but, haven't found any documentation as to what it will actually
return etc..

If I can simply use this function, please do tell.

If anyone out there has any helpful advice, it would be greatly appreciated.

This is the code that I need to fix to bring in the link object type:

         <code>

<h3><?php _e('General Settings')?></h3>
            <table class="form-table">
                <tr valign="top">
                    <th scope="row"><?php _e('Related Object Types')?></th>
                    <td>


<?php foreach(get_post_types(null, 'objects') as $post_type): ?>

<?php if((isset($post_type->public) && $post_type->public) ||
in_array($post_type->name, array('post', 'page', 'attachment'))):?>

<input type="checkbox" id="object_types_<?php echo
esc_attr($post_type->name)?>" name="object_types[]" value="<?php echo
esc_attr($post_type->name)?>"<?php echo
$taxonomy->supports_post_type($post_type->name) ? ' checked="checked"' :
''?> />

<label for="object_types_<?php echo esc_attr($post_type->name)?>"><?php echo
$post_type->name?></label>



<br />
                            <?php endif; ?>
                        <?php endforeach; ?>
                    </td>
                </tr>
            </table>
            <p class="submit"><input type="submit" name="submit"
value="<?php esc_attr_e('Submit'); ?>" class="button-secondary" /></p>
        </form>
        <?php
    }

</code>

Thanks again to anyone who can help me with this~
Angie


More information about the wp-hackers mailing list