Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #774192

    launchcatapult
    Participant

    Hi there,

    I am trying to add my own custom elements in Cornerstone. I have already read all of the documentation at https://community.theme.co/kb/cornerstone-custom-elements/ and followed the directions. I also referenced the Author Element as recommended and duplicated what is happening there. I cannot get my cornerstone Element to pull in. I did a die test to make sure my file is being pulled in and read and it is, however my custom element still will not display. Hopefully you can shed some light on what I am doing wrong so I can get my custom elements to load?? Thank you in advance!

    The function code loading the custom elements:

    <?php
    // =============================================================================
    // INCLUDES/LOAD-RES-CORNERSTONE.PHP
    // -----------------------------------------------------------------------------
    // The Loader that handles custom Resonetics Cornerstone elements
    // =============================================================================
    
    // Define Constant and Load Files if the Cornerstone Class Exists
    // =============================================================================
    
    if ( class_exists( 'Cornerstone_Plugin_Base' ) ){
    
    	if ( ! defined( 'RES_CORNERSTONE_MODULE_PATH' ) ){
    		define( 'RES_CORNERSTONE_MODULE_PATH', get_stylesheet_directory() . '/includes/resonetics-cornerstone' );
    	}
    
    	//Hook into cornerstone Element load
    	add_action( 'cornerstone_load_elements', 'res_custom_cornerstone_elements' );
    
    	function res_custom_cornerstone_elements() {
    
    		//Graphic Roll-over element
    		require_once( RES_CORNERSTONE_MODULE_PATH . '/icon-graphic-roll-list.php' ) ;
    		cornerstone_add_element('Res_Icon_Roll_List');
    
    	}
    
    }


    The Actual Element Build

    <?php
    
    class RES_Icon_Roll_List extends Cornerstone_Element_Base {
    
      public function data() {
        return array(
          'name'        => 'icon-graphic-list-1',
          'title'       => __( 'Resonetics Icon Graphic 1', csl18n() ),
          'section' => 'information',
          'description' => __( 'Outputs an image with a rollover that contains a heading element and a list', csl18n() ),
          'supports'    => array( 'id', 'class', 'style' )
        );
      }
    
      public function controls() {
    
      $this->addControl(
          'src',
          'image',
          __( 'Icon', csl18n() ),
          __( 'Select Your icon.', csl18n() )
          );
    
        $this->addControl(
          'heading',
          'text',
          __( 'Title', csl18n() ),
          __( 'Enter the main title for your list ( always visible )', csl18n() )
        );
    
        $this->addControl(
          'item_1',
          'text',
          __( 'First List Item', csl18n() ),
          __( 'Only visible on roll-over', csl18n() )
        );
        $this->addControl(
          'item_2',
          'text',
          __( 'Second List Item', csl18n() ),
          __( 'Only visible on roll-over', csl18n() )
        );
    
    $this->addControl(
          'item_3',
          'text',
          __( 'Third List Item', csl18n() ),
          __( 'Only visible on roll-over', csl18n() )
        );
    
    $this->addControl(
          'item_4',
          'text',
          __( 'Fourth List Item', csl18n() ),
          __( 'Only visible on roll-over', csl18n() )
        );
    
      }
    
      //Ignoring deving this section for now until I can actually get the element to display in Cornerstone
      public function render( $atts ) {
    
        extract( $atts );
    
        $shortcode = "[icon_graphic_roll_list title=\"$heading\" author_id=\"$author_id\"{$extra}]";
    
        return $shortcode;
    
      }
    
    }
    #774383

    Christopher
    Moderator

    Hi there,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #774489

    launchcatapult
    Participant
    This reply has been marked as private.
    #774778

    Nabeel A
    Moderator

    Hi again,

    Can you please provide the FTP credentials as well in a private reply so we can take a look? You can create a separate username password for this account and send that one to us.

    Thanks!

    #778045

    launchcatapult
    Participant

    Do you guys have a Flywheel account? That’s what we use and ir requires you to register really fast so I can add you as a collab. Can you shoot me over what your email for support is and I will add you!

    #778443

    Jade
    Moderator

    Hi there,

    Unfortunately, we don’t have a FlyWheel account. We could do some further checking on your code through FTP though so kindly provide us with the details so that we can assist you further. 🙂 Thank you.

    #778516

    launchcatapult
    Participant
    This reply has been marked as private.
    #779112

    Rad
    Moderator

    Hi there,

    There is one missing piece 🙂

    You forgot to add your own shortcode, each cornerstone element is a representation of a shortcode, and you don’t have shortcode.

    It should be registered with add_shortcode().

    Please check the sample code from this thread,

    https://community.theme.co/forums/topic/cornerstone-not-loading-20/page/2/#post-738027

    The shortcode is your element’s main functionality, what does your shortcode should do?

    Cheers!

    #779613

    launchcatapult
    Participant

    Ahhh…ok. So in order for the element to appear at all in the Cornerstone element choices, it must be registered via the Cornerstone api AND it must have a registered shortcode? I was thinking I would see if the element showed up first before building out my shortcode! lol.

    I wish some of the Cornerstone documentation was a bit more clear / there was more of it. We are going to start using x-theme on a lot of our sites, and we will be build many custom elements. If you have any more documentation/info you could pass along other that what is in the knowledge base, it would be awesome! We are coming from using Visual Composer where there is a lot of info / very clear instructions on extending it and developing your own custom elements and it was a big help for our team to have all of those resources available to us.

    #779950

    Rupok
    Member

    Hi there,

    Thanks for writing back. We certainly appreciate your feedback. I believe it will be the documentation will be more extensive for the developer. As you know we tried to make the page builder so easy to understand that user can learn it by playing with it easily. However still the API part could be more descriptive for better understanding and hopefully we’ll do it soon.

    Thanks for your valuable feedback and continuous support for X community. 🙂