Forums

Make Category.php template ignore Read More tag (2 posts)

  1. M.K.
    Member
    Posted 3 years ago #

    I want Google to see lots of content in mydomain.com/category/keyword/

    So, even though I want the posts on the homepage to obey the Read More tag, on the category page, I want to always show the whole post...How?

  2. Zambrano Sergio
    Blocked
    Posted 3 years ago #

    You have to put the content of the hidden text inside a div tag, assign it a class, like .more , and then to put a little Javascript in the "read the whole thing" link like this

    <a>onclick=
    "this.parentNode.parentNode.className+=' expanded';"
    href="javascript://;">abrir</a>

    That will assign the class "expanded" to whatever the great grand-father of that link is. (e.g. the link is inside a paragraph, which is inside your container, which will receive the "expanded" class. You just keep adding or removing .parentNode to match your html structure and make sure to target the parent of the div to hide.

    Then you just create a css rule like

    .more {
    display: none;
    }
    
    .expanded .more {
    display: block;
    }

    You can use a similar structure to hide the "read the full thing" link and inside the hidden div you put another link with an "close" link and a similar script to replace the "expanded" class with "" (empty value) to get the div back to the original state.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.