Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cobaltapps/6214475 to your computer and use it in GitHub Desktop.
Save cobaltapps/6214475 to your computer and use it in GitHub Desktop.
Use this code if you'd like to use an external Custom Stylesheet in Dynamik Website Builder. Note that this code assumes you have created a my-custom.css file and uploaded it to your /wp-content/uploads/dynamik-gen/theme/ directory.
add_action( 'wp_enqueue_scripts', 'custom_add_stylesheet' );
/**
* Enqueue an external Custom Stylesheet to Dynamik Website Builder
*/
function custom_add_stylesheet()
{
wp_enqueue_style( 'my-custom', dynamik_get_stylesheet_location( 'url' ) . 'my-custom.css', false, filemtime( dynamik_get_stylesheet_location( 'path' ) . 'my-custom.css' ) );
}
@iTerentius
Copy link

iTerentius commented Jun 1, 2017

Hello,

So, I've followed these instructions on a staging site. I'm trying to alter the widths and floats of .site-inner and .content-sidebar-wrap to try and allow for the visual composer full-width rows to extend to the edges but keep the content in the original width. However, upon inspection after applying your above function.php code through the dynamic admin with my custom css, it doesn't even seem to be even loading file. The original styles are the same and I don't even see my stuff from my custom file as being overridden.

It seems as if this is not actually enqueuing the styles, which makes me think this is not actually working. I've double checked my css file name, location etc and it should be working:

This is in the 'functions' area of the Dynamic control panel:

<?php
/* Do not remove this line. Add your functions below. */
add_action( 'wp_enqueue_scripts', 'custom_add_stylesheet' );
/**
 * Enqueue an external Custom Stylesheet to Dynamik Website Builder
 */
function custom_add_stylesheet()
{
    wp_enqueue_style( 'mhi-custom', dynamik_get_stylesheet_location( 'url' ) . 'mhi-custom.css', false, filemtime( dynamik_get_stylesheet_location( 'path' ) . 'mhi-custom.css' ) );
}  

And this is in the mhi-custom.css in the /wp-content/uploads/dynamik-gen/theme directory

.full-width-content .site-inner {
    width: 100% !important;
}

.content-sidebar-wrap {
    float: none !important;
    margin: 0 auto !important;
}

I'm not even sure if those are the appropriate css style edits I want to make overall, but my goal is to get the visual composer full-width rows to stretch and leave the content in the normal full-width area. This works with the genesis paralax pro child theme using your extender plugin, but not with Dynamic. As such I'm trying to altar the Dynamik css like I normally would.

Any suggestions would be most welcome.

Thanks,
Isaac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment