Proper way to add custom markup attributes


Hi Anna,

You understood the concept perfectly well 🙂 The issue here is the markup id, your are using - instead of _. The markup id for the post header is beans_post_header (refer to this reply for more info about the hooks and markup id). For example the code below would make the post header background red:

beans_add_attribute( 'beans_post_header', 'style', 'background: red;' );

Regarding pulling from the admin, yes you can totally do that! You have to register a field for it and retrieve the data which you can then use to add your attribute.

Have fun,


Thanks for response!

I'm very sorry, there was a typo only in my post - code returnsstyle=url() in proper markup. I just don't know how to retrieve the custom data in functions.php.


Hey Anna,

Could you paste the code you are using the register the field so that I can provide you with a complete working snippet. Here is a discussion which might help you too.

Thanks,


Thank you, link was very helpful. I was trying to reach those attributes without any action, barely in functions.php.


Great stuff Anna, I am happy to hear you managed to get it working.

Keep up the good work and have fun,

Write a reply

Login or register to write a reply, it's free!