ThemeShaper Forums » Thematic

[closed]

helper-extensions function: thematic_is_custom_post_type

(7 posts)
  • Started 3 years ago by ridgely
  • Latest reply from ridgely
  • This topic is resolved
  1. I noticed that the 0.9.7.4 (rev709) helper-extensions.php includes what appears to be a *most* helpful function, i.e.

    function thematic_is_custom_post_type() {
        global $post;
        if ($post->post_type !== "post") {
            if ($post->post_type !== "page") {
                return true;
            }
        }
        return false;
    }

    but where/when is it specifically appropriate to call this function? I was hoping one of our php/thematic experts could use this in a "sentence" i.e. provide some contextual examples for optimally implementing this function? For example, could it be used in a condition to filter thematic_page_title in a custom-post-type page template? If not, what might one use it for? Thanks in advance.

    Posted 3 years ago #
  2. Goran
    Member

    Well, a post that is of a custom type by default uses all the same templates as a normal post. You could add something to the page only if the post is of a custom type.

    Posted 3 years ago #
  3. So then it's used with is_single? What about on custom page templates used to show custom post types?

    Posted 3 years ago #
  4. Ridgely,

    I added that helper function to enable paginated body classes for custom post-types. I'm not certain how else it can be of use unless you need a conditional tag for custom post-types to be separate from plain old pages and posts.

    -Gene

    Posted 3 years ago #
  5. Ok, gotcha. So it's used to further fine-tune is_paged, correct?

    I'm not certain how else it can be of use unless you need a conditional tag for custom post-types to be separate from plain old pages and posts.

    Well, yeah. For example, with my custom post types (painting & drawing), I had created a page template to display each. But I had not gotten around to creating a single-type.php template for each of them - I'd prefer to filter the thematic functions in thematic_singlepost. And as it stands, my single custom post footers contain an empty cat-links span and no tags:
    "This entry was posted in . Bookmark the permalink...."
    Could thematic_is_custom_post_type be employed to filter the thematic (is_single) postfooter to show the custom taxonomies and terms associated with a single post, and if so, how? If not, what would be a best-practice workaround?

    Posted 3 years ago #
  6. Honestly, I'm playing catch up with custom post types and taxonomies. I always find myself heading back to Justin Tadlock's site for the finer details. Another good source is Michael Field's site Maybe some of his posts on the subject will help you. If you start making head way report back and share ;)

    -Gene

    Posted 3 years ago #
  7. Definitely will, Gene. Speaking of which, I just wrote a content filter to show a couple of my custom taxonomies (medium and support, e.g. "paper" or "canvas") at the bottom of my single painting and drawing posts. (I wanted to still use the thematic single.php because it's so versatile, but I needed some tweaks):


    function artifact_taxlists ($content) {
    if (is_singular() && get_post_type() == 'drawing' || 'drawing' ) {
    $content .= '<div id="artaxicon" class="entry-specs">';
    $content .= '<p id="mediumlist" class="rs-termlist">';
    $content .= get_the_term_list($post->ID, 'medium', '<span class="rs-tax"> Medium(s):</span> ', ' • ', ' ' );
    $content .= '</p>';
    $content .= '<p id="supportlist" class="rs-termlist">';
    $content .= get_the_term_list( $post->ID, 'support', '<span class="rs-tax"> Support(s): </span> ', ' • ', ' ' );
    $content .= '</p></div>';
    }
    return $content;
    }

    add_filter ('thematic_post', 'artifact_taxlists', 10);

    Hope this helps someone. :)

    Currently working to replace the postcategory in certain instances of postfooter with my own hierarchical taxonomy, but not sure how to swing that with cats_meow.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.