- This topic has 9 replies, 3 voices, and was last updated 4 years, 5 months ago by Tom.
-
AuthorPosts
-
September 25, 2019 at 2:22 am #1018393Pete
I’ve got an awesome idea Tom… hear me out!
Have a tick box on each element/hook ‘post’ that will ,
<span>
the hook in it’s own class using the post ID of the element post!e.g.
<span class="1234"> all my awesome hook stuff </span>
You like it… don’t you Tom.
September 25, 2019 at 3:36 am #1018439DavidStaffCustomer SupportHi there,
interesting – what would be the purpose / benefit of doing so?
September 25, 2019 at 3:39 am #1018444PeteHaving the option to apply custom css to that particular area.
For example you have some H2 after the main content and want to apply css to just the hook H2. Without a class, the H2 styling could apply to the whole page.
Often we apply code via the element hook that contains specific information that may often need separate styling.
Having a quick automatic way of adding a css class that can be associated with the specific hook would be be handy to find and apply css.
Infact, even a body class of all the post element hook IDs applied to each page would be handy.
September 25, 2019 at 5:10 am #1018494DavidStaffCustomer SupportMaybe some merit in Body classes, like the post-ID-XXX, for page level styling but i generally use body classes related to the Display Rules i am using.
Auto adding a HTML wrap to the content with a rather non-descriptive CSS class i could see leading to more work and harder to maintain code. You would also need to select which HTML element to wrap the hook content in.
It is better to add your own HTML wrap and well named CSS Classes.
September 25, 2019 at 5:12 am #1018499PeteAuto adding a HTML wrap to the content with a rather non-descriptive CSS class
Then maybe the element post title?
September 25, 2019 at 5:51 am #1018531DavidStaffCustomer SupportWhat happens if the element title is really long or worst still if it gets edited?
Also have to consider what the HTML wrap element would be – if clicking a button to add the class automatically wraps my content in a SPAN – it could lead to invalid HTML if my content contains a block element. So that requires another option.You also end up writing very specific CSS rules for that element alone. Which could lead to duplicate CSS rules or having to string multiple selectors for each rule e.g
.my-hook-element-101, .my-hook-element-102, .... { /* CSS properties */ }
which makes maintenance more complicated.
As opposed to adding your own wrap and necessary classes e.g:
<div class="db-call-to-action db-large-heading"> <!-- After Header CTA --> <!-- more HTML --> </div>
Case for creating a CTA below the header – i can reuse the
db-call-to-action
class for a CTA element elsewhere but choose to omit thedb-large-heading
class or add others. So my CSS is now made of re-usable blocks of code.All suggestions to help automate frequent user actions are well received and appreciated. I just think there is too many variables to be considered here and second guessing what users are expecting would be problematic.
September 25, 2019 at 5:58 am #1018533PeteIf it’s added as a tick box option and the post IDs clearly shown on the post edit page (and the list of posts) then I think that’s workable.
September 25, 2019 at 10:17 am #1018851DavidStaffCustomer SupportMaybe i am missing something but i can’t see what the benefit is – when i can simply add two lines of HTML to the Hook content:
<div class="my-unique-class any-other-reusable-class"> <!-- HTML / Code etc here --> </div>
November 1, 2019 at 11:38 pm #1051065PeteI can have over 30 hooks easy, ticking adding that above is harder than having it auto inserted or ticking a box.
November 2, 2019 at 9:32 am #1051463TomLead DeveloperLead DeveloperThanks for the suggestion, Pete! Appreciate it 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.