• I have many custom taxonomies on a child theme at amyatwoodtestsite.com.
    I’m trying to assign a class to ONE of the custom taxonomies (“wines”), so that I can edit the taxonomy archive in css.

    Here’s the code, but it’s not working:

    <div class="wines">
    		<?php if (get_the_term_list( $post->ID, 'wines' ) != null ) { ?>
    			<div>Wines: <?php echo get_the_term_list( $post->ID, 'wines', '', ', ', '' ); ?></div>
    			<?php } ?>
    			</div>

    I could use help.

Viewing 9 replies - 1 through 9 (of 9 total)
  • For help with CSS issues, please provide a site link…by creating a unique class for the container, you can further style elements within it:

    example:

    .wine p {
    font-size: 1.5em;
    color: #000;
    }

    The elements within your div likely already have classes or id’s assigned, so specifying as above overrides the overall style of p.

    Thread Starter dgissen

    (@dgissen)

    “wines p” didn’t work.

    Here’s a link

    the other custom taxonomies are styled with:
    .entry-meta-custom

    Not sure why .wines is not working.

    Why do you say it’s not working – this CSS IS working:

    .wines {
        line-height: 3rem;
    }

    Thread Starter dgissen

    (@dgissen)

    Good point. Yes, that works, but when I try “display: block” it doesn’t. not sure what’s going on.

    I want them to display one wine to a line.

    Since those are links, I think you need this:

    .wines a {
       display: block;
    }

    Looks like you also need to get rid of the commas.

    Thread Starter dgissen

    (@dgissen)

    yes; and how do I get rid of the commas? remove them from the php code?

    Thanks!

    Yep, it looks like they’re in that PHP code you posted above.

    Thread Starter dgissen

    (@dgissen)

    just removing them doesn’t work. Any ideas?

    Thread Starter dgissen

    (@dgissen)

    figured it out:
    <div>Wines: <?php echo get_the_term_list( $post->ID, 'wines'); ?></div>

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘assigning class to custom taxonomy for css editing’ is closed to new replies.