Modify standard kirbytags


#1

Hey forum,

is there a way that I can modifie the standard kirbytags like blockquote, figure etc without creating new kirbytags?
Or maybe just overwrite the standard tags?

For example I need to add a class to the blockquote :slight_smile:

Thanks in advance!
Florian


#2

Yes, you can make a copy of the original tag and save it under the same name in /site/tags. But there is no blockquote kirbytag?


#3

Oh yeah, I guess cause I use the plugin markdown :see_no_evil:

Is there a way to edit this with that plugin? I searched in the files of that plugin but I cant find the part where the tags are defined…


#4

@texnixe Sorry to bother you again. I can’t really “figure” it out. So I copied the image tag and created a new tag. No I want to add a class which is always used for the tag. So that it will end like this:

<figure class="figure">
    <img class="img-fluid" />
    <figcaption class="figure-caption"></figcaption>
</figure>

#5

To add a class to the figure tag, you can before or after this line

  $figure->addClass($tag->attr('class'));

add

  $figure->addClass('figure');

then do the same for the image and figcaption.


#6

I think if that was me, I would just add the .figure class, because the other elements can be targeted through it in CSS. Saves you a bit of logic :slight_smile:

It might sound nitpicky, but actually if you make small changes like this across a whole site, the css and PHP will be easier to read, and lighter.


#7

@jimbobrjames yeah I agree, but for this Iam using a css framework and I dont want to change things here :smiley:

@texnixe worked! Thanks so much!


#8

Fair enough. I’m resisting giving my usual anti Bootstrap rant :slight_smile:

Glad you got it working.


#9

@jimbobrjames This time its a self written css framework from a client :smiley: :smiley:


#10

Cool. Might not be so bad then. I am big believer in building the right tools. Off the shelf code isnt always a timesaver.

Feel free to give my framework a go some time. I’d love to see projects built with it by other people.