Hide text

  • sylvia

    #3198

    Looking for a little help here. In all my posts I insert at least one image…and at the bottom of all these posts I have a line of text that gives credit to the photographer. My question is….I don’t want this line of text to be displayed when the posts are viewed in excerpt view (example – category archives). Is there a way to hide this line of text in excerpt view using CSS? Function? Plugin ?

    Mod

    Kenneth John Odle

    #23846

    If that line of text has a special class (say .credit for example), then you could hide it in category pages like this:

    .category .credit {display:none;}

    I believe the same thing would work for excerpts, using .excerpt in place of .category You may need to use the HTML editor to assign that special class, however.

    soapy

    #23847

    Ken, thanks for the reply but that did not work. I put the following code at the end of a post:

    <div class="photo_credit">Image via John Smith</div>

    In normal post view….it allowed me to apply css to this div. When I viewed this post in my category archives….it took the text and placed it inside the </p> tags of the post and removed the “photo_credit” class….so my “photo_credit” css had no effect on it in category archives view. Can you offer any suggestions? Thanks

    soapy

    #23848

    Ken,

    Never mind….I see in the excerpt options I had to retain the div tag….so its working now.

    One other question though….how did you know that the .category class existed?? When I was troubleshooting my code in the firefox inspector….I could not see that class anywhere???

    Mod

    Kenneth John Odle

    #23849

    It’s part of the basic structure of a Graphene page, applied to the <body> element. So just use Firebug or “view source” to examine the <body> tag to see what you are dealing with.

    Others include:

    home — the home page

    single — for a post

    page — for a page

    category — for a category archive

    tag — for a tag archive

    archive — for any kind of archive

    There may be others…I forget sometimes. But this is very useful when working with PHP.

    soapy

    #23850

    Thanks Ken.

    To be honest…I still can’t find it. I know if I click on an element in firebug and view its source…at the top of firebug its shows the hierarchy of its parent elements all the way back to the <html> tag….but the list of classes that you show above does not appear anywhere in that hierarchy. This is how I always determine what css tag i need to modify….but for some reason with that category tag not being displayed….it made this difficult for me.

    Nonetheless…this is great information to know and makes things a lot easier for me! Thank you!

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

  • You must be logged in to reply to this topic.