Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1342206

    threadinc
    Participant

    Is there anyway to hook into Cornerstone so that when a new section is created the default padding is number that I define?

    This has caused me issues on many sites already and this is a much needed fix. Not only is it limiting to have a set value for each section, overriding it is near impossible as it creates inline elements so you would need to either apply a specific class or override ALL sections.

    It’s not even set to a fluid value which would be way more useful considering how large 45px is on a mobile device. This causes just another step for my clients to learn when it should be effortless for them.

    #1342220

    Nico
    Moderator

    Hi There,

    Thanks for writing in.

    To change the default padding or spacing, you could this code below to make as a default section space.

    .x-section{
    margin:0px;
    padding:0px;
    }

    Hope it helps.

    Let us know how it goes.

    Thanks.

    #1346652

    threadinc
    Participant

    Thanks for the response, however this is not a solution.

    For starters, xTheme injects the default padding as inline styles meaning in order to overwrite them you would need to use !important tags. This however, will give all sections 0 padding and 0 margin and not allow the customer to change these values on a case by case basis within X.

    I’m looking for a way to set new defaults within X. This has to be a highly requested feature, to arbitrarily choose 45px every time I add a new section is kinda crazy. Everyone’s designs are different which calls for different spacing on a case by case basis. When I pass off a design to a client I want them to only have to click new section and go to work. Not teach them every time to update their padding to 5%, 30px, or whatever the design calls for before they add their content.

    Does this make sense now? I want this to happen automatically in X when a new section is added. Even if I have to get by with a quick hook into the function and hard code my defaults on a site to site basis for now until a better option is available.

    #1346686

    Joao
    Moderator

    Hi There,

    I totally agree with you, I will pass your message to development team.

    Thanks for the feedback.

    Joao

    #1372147

    threadinc
    Participant

    I have an update for those looking to override the default padding on sections in cornerstone but don’t have time to wait for Themeco to add this in as an option.

    Add the following code to your functions.php file

    /* Update the default settings for the section module */
    function update_section_defaults($defaults) {
    	$defaults ['padding'] = array( '45px', '0px', '45px', '0px', 'unlinked' );
    	return $defaults;
    	};
    	
    add_action ('cs_element_section_update_defaults','update_section_defaults');

    Just replace the values above with the padding you want. These changes will effect all new sections added as well as any sections that were left default but you will have to resave in cornerstone for the new settings to take effect.

    Here is the complete list of settings that can be updated:

    'id'           => '',
    	'class'        => '',
    	'style'        => '',
    	'text_align'   => 'none',
    	'visibility'   => array(),
    	'margin'       => array( '0px', '0px', '0px', '0px', 'unlinked' ),
    	'padding'      => array( '45px', '0px', '45px', '0px', 'unlinked' ),
    	'border_style' => 'none',
    	'border_color' => '',
    	'border_width' => array( '1px', '1px', '1px', '1px', 'linked' ),
    
    	'bg_type'           => 'none',
    	'bg_image'          => '',
    	'bg_color'          => '',
    	'bg_video'          => '',
    	'bg_pattern_toggle' => false,
    	'parallax'          => false,
    	'bg_video'          => '',
    	'bg_video_poster'   => ''

    So you could use the same function to hook into a different setting as well if needed.

    #1372353

    Joao
    Moderator

    Hi There,

    Thanks for your input to the community.

    Cheers