Navigation

This content is old and no longer supported. You may use at your own risk, but no official support will be provided for anything listed here. If you are a Themeco customer, we invite you to check out our new community and forums, Apex.

Tagged: 

  • Author
    Posts
  • #1326892

    filipve
    Participant

    Hi,

    What is the best recommended way to make custom elements?

    Do we really need to use the four files of definition, shortcode, defaults.php and controls.php?

    Or is it better that we use the “extends Cornerstone_element_base” way? like theme x did for the existing elements now?

    I am curious what is the best way recommended for developers from the two ways?

    #1326935

    Rad
    Moderator

    Hi there,

    Thanks for writing in.

    Yes, it’s important and it’s part of cornerstone standard. It makes code cleaner and properly grouped/ordered, and since cornerstone is using transients, it will be faster since cornerstone can call them by part.

    Thanks!

    #1326938

    filipve
    Participant

    oke, because then I would ask if it would be possible to give some more information about the possibilities with the controls.

    Because I find the examples too basic,

    and it would be nice to have some explanation about how the ‘context’ option works like ‘context’ => ‘content’.

    Because the explanation now about custom element misses a lot I think of crucial information to make nice custom elements?

    #1327035

    Rad
    Moderator

    Hi there,

    Yes, the examples are basic. It will be harder to follow if it’s too complex.

    And about the context, it’s under the Mapping element control sections.

    At this level of the control definition, you will also see context and suggest paired together. This is preparatory work in the API for an upcoming Cornerstone feature where users will be able to set the default values of element controls globally. If you set ‘context’ => ‘content’, you can prevent users from editing controls that may not make sense to have a global value for. suggest can be used to provide a default value in that case.

    There will be an upcoming change in the cornerstone, maybe major changes and documentation may change as well. I understand it’s a bit crowded but we’ll improve it. For now, it only covers the basic one, and if you wish to dig deeper, you can find existing elements from cornerstone itself though its source files.

    \wp-content\plugins\cornerstone\includes\elements\
    \wp-content\plugins\cornerstone\includes\elements\_alternate\
    \wp-content\plugins\cornerstone\includes\shortcodes\

    Though, you can stay for the basic for the meantime and you may open new thread if you run into some issues.

    Thanks!

Join Apex

This content is old and no longer supported. We invite you to check out our new community and forums, Apex.

Join Apex