- This topic has 19 replies, 4 voices, and was last updated 3 years, 3 months ago by Elvin.
-
AuthorPosts
-
December 21, 2020 at 7:14 am #1589439William
Hi there,
Is there a way to make a div element all linkable to the category of that post in the header element? – the bit in yellow:
So it mimics the functionality you can see here.December 21, 2020 at 8:23 am #1589566DavidStaffCustomer SupportHi there,
can you link me to a page where you want to add this functionality?
December 22, 2020 at 11:20 am #1591079December 22, 2020 at 1:01 pm #1591191DavidStaffCustomer SupportWithout editing the HTML you can use some CSS like this to make the header elements meta-category clickable:
.page-hero .meta-category { display: inline-block; position: relative; } .page-hero .meta-category a:before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
December 22, 2020 at 3:45 pm #1591321WilliamThat does not seem to have done anything.
I am trying to replicate the click area that you can see with this theme here.
December 22, 2020 at 6:21 pm #1591403ElvinStaffCustomer SupportHi,
For this page:
LinkAny particular reason why you want to keep its html this way?
Consider changing the HTML structure of its Header Element to this:
<div class="meta-category"> <a href="https://wordpress-425633-1630880.cloudwaysapps.com/claude-mckay/" rel="tag"> <span class="cat-first-letter">C</span> <p style="display:inline-block;">- Claude McKay need to make all a link</p> </a> </div>
So that everything is wrapped similar to your reference.
December 23, 2020 at 6:20 am #1591923WilliamThat’s great thank you – is there a way to have the text centered vertically against the big letter and have the same hover effects as this?
Also, can the linking area for the text is just on the text – is it possible to have some sort of padding so the linking area around the text is the same as here?
December 23, 2020 at 11:25 am #1592420TomLead DeveloperLead DeveloperAre any of the links you’ve shared your actual page that you’re working on? I’ve looked through and all the links seem to be the same site where the look of it seems complete?
Let me know 🙂
December 26, 2020 at 1:26 pm #1595126WilliamThe actual page is this page<–This is the site I am working on.
But as with my last comment, I reference another theme to copy similar functionality as I said here:
That’s great thank you – is there a way to have the text centered vertically against the big letter and have the same hover effects as this?
Also, can the linking area for the text is just on the text – is it possible to have some sort of padding so the linking area around the text is the same as here?
December 27, 2020 at 11:05 am #1595925TomLead DeveloperLead DeveloperThis should help vertically center it:
.meta-category { display: flex; align-items: center; } .meta-category p { margin-bottom: 0; }
To make the entire thing a link, you should do something like this:
<a href="https://wordpress-425633-1630880.cloudwaysapps.com/claude-mckay/ class="meta-category"> <span class="cat-first-letter">C</span> <p style="display:inline-block;">- Claude McKay need to make all a link</p> </a>
December 27, 2020 at 12:53 pm #1596006WilliamThank you for that – centering works a treat.
As for the link – I would require something generic so that the link for the div element changes to the primary category of the post – possible using the shortcode for {{post_terms.category}}, however, not sure how to implement this correctly?
December 28, 2020 at 11:57 am #1597286TomLead DeveloperLead DeveloperSo you need the URL to update based on the category? Which category, exactly? The current one?
December 28, 2020 at 1:22 pm #1597380WilliamThat’s correct – whatever the post category is, the link should update to that category.
December 29, 2020 at 7:48 am #1598387DavidStaffCustomer SupportHow are you currently creating the category meta?
December 29, 2020 at 12:08 pm #1598661WilliamFor this page, the header element is:
<div class="meta-category"> <a href="https://wordpress-425633-1630880.cloudwaysapps.com/claude-mckay/" rel="tag"> <span class="cat-first-letter">[cat-first-letter]</span> <p style="display:inline-block;"> - {{post_terms.category}}</p> </a> </div> <h1 class='post-title'> {{post_title}} </h1> <div class="post-excerpt"> [post-excerpt] </div>
But where the a href needs to update according to the category of the post (to link to that category) and to link the whole div element ‘meta-category’.
-
AuthorPosts
- You must be logged in to reply to this topic.