How to add a custom class

Community Forums Forums Design Tips and Tricks How to add a custom class

This topic is: resolved

This topic contains 7 replies, has 2 voices, and was last updated by  Jen Baumann 2 years ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #4181

    DigitalC
    Participant
    Post count: 20

    I need to add a custom class to my entry-content div in the html. Can someone help me figure out how to do that? Thanks!

    #4197

    Jen Baumann
    Keymaster
    Post count: 444

    Can you explain more what you are trying to accomplish?  Depending on what you are doing, you probably don’t need to add a class to the entry-content div and can either use existing body or post classes.


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    #4205

    DigitalC
    Participant
    Post count: 20

    I installed a plugin called “Print Friendly and PDF” and I’m having a problem where it is only selecting some of the content on my page to print. Their support response was that I had to add a class called print-friendly to my entry-content div. So that’s what I was trying to do. If there’s an easier way, I’m all for it.

    #4220

    Jen Baumann
    Keymaster
    Post count: 444

    I found your post here: http://wordpress.org/support/topic/missing-content-in-print-friendly-page

    It is probably better to add a post class.

    add_filter('post_class', 'additional_classes');
    function additional_classes($classes) {
    $classes[] = 'myclass';
    return $classes;
    }


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    #4226

    DigitalC
    Participant
    Post count: 20

    And that would go in the functions file?

    #4230

    Jen Baumann
    Keymaster
    Post count: 444

    Yes, it would :0)


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    #6301

    DigitalC
    Participant
    Post count: 20

    Hey, sorry for the delay, just wanted to let you know that worked and got me where I wanted to be! Thanks so much for your help.

    #6302

    Jen Baumann
    Keymaster
    Post count: 444

    Glad that worked! You’re very welcome!


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘How to add a custom class’ is closed to new replies.