Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mrangelmarino

    (@mrangelmarino)

    Thanks, David!

    Thread Starter mrangelmarino

    (@mrangelmarino)

    How does one gain access to the wp-advanced forum? It says you have to be a moderator to post there.

    Thread Starter mrangelmarino

    (@mrangelmarino)

    I’m going to put this here because this is terribly documented, practically un-Googleable. I found a partial solution to adding the custom taxonomy tags to the post classes:

    <?php add_filter( 'post_class', 'mysite_post_class', 10, 3 );
    if( !function_exists( 'mysite_post_class' ) ) {
        /**
         * Append taxonomy terms to post class.
         * @since 2010-07-10
         */
        function mysite_post_class( $classes, $class, $ID ) {
            $taxonomy = 'you_custom_taxonomy_term';
            $terms = get_the_terms( (int) $ID, $taxonomy );
            if( !empty( $terms ) ) {
                foreach( (array) $terms as $order => $term ) {
                    if( !in_array( $term->slug, $classes ) ) {
                        $classes[] = $term->slug;
                    }
                }
            }
            return $classes;
        }
    }?>

    Just add it before the post tags after the loop starts.

    More documentation here: https://davebonds.com/blog/add-css-classes-for-custom-taxonomies-in-wordpress.html

    Thread Starter mrangelmarino

    (@mrangelmarino)

    Well, I guess it’s three things, really.

    1. List all custom taxonomies as text on the custom post type archive page.

    2. List a post’s associated custom taxonomy terms on a custom post single page.

    3. Add a class of the custom taxonomy to the post div class, and add custom taxonomy text to links.

    ****

    To elaborate, I want a list of custom categories at the top of the custom post archive page. But I want to customize their link text because I want to use this jQuery sorting plugin.

    So ideally, the <a href> for each listed category would be a hash tag (#) followed by the taxonomy term, like this:

    <li><a href="#custom-taxonomy-name-one">Custom Taxonomy Name One</a></li>
    <li><a href="#custom-taxonomy-name-two">Custom Taxonomy Name Two</a></li>

    THEN, each post would have the taxonomy term as a class, like this:

    <article class="custom-taxonomy-name-one">
    <!--stuff-->
    </article>
    
    <article class="custom-taxonomy-name-two">
    <!--stuff-->
    </article>

    Does this make sense?

    Try going to “Settings > Reading” and see if you altered your front page or blog page at all.

    Edit: NVM. Just saw that you checked that.

Viewing 5 replies - 1 through 5 (of 5 total)