Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Did files order change again? #750

Closed
danyj opened this issue Jul 22, 2015 · 10 comments
Closed

Did files order change again? #750

danyj opened this issue Jul 22, 2015 · 10 comments

Comments

@danyj
Copy link
Contributor

danyj commented Jul 22, 2015

I was busy with designs past 6 weeks and just getting back to coding. Latest version I worked intensively on was 2.3.2. Today I updated to 2.4.1 and again have issues with dynamic styles load.

The hooks.php used here
#275 (comment)

seems like it loads after wp_head again. All dynamic styles are gone.

@ghost
Copy link

ghost commented Jul 22, 2015

Nothing was changed, the code looks fine https://github.com/ThemeFuse/Unyson-Shortcodes-Extension/blob/79f8054c9e759c32d07fe9c479cb8387251642c5/class-fw-extension-shortcodes.php#L50-L51
Add some fw_print() on wp_head action and in your enqueue callback to see which will be called first.

@danyj
Copy link
Contributor Author

danyj commented Jul 22, 2015

@moldcraft thnx bud , seems like it is on my end ,

hooks prints show first
http://prntscr.com/7vrnx5

will have to digg a bit, nothing worse than getting back after long time.

@danyj danyj closed this as completed Jul 22, 2015
@ghost
Copy link

ghost commented Jul 22, 2015

I was busy with designs past 6 weeks

P.S. We added these instructions in documentation. Node the fw_ext_shortcodes_decode_attr() function #469

@danyj
Copy link
Contributor Author

danyj commented Jul 22, 2015

@moldcraft thnx bud , that is exactly what I have but I must have forgotten something else since I was pulled away in mid of huge change. Unyson seems fine.

@danyj
Copy link
Contributor Author

danyj commented Jul 22, 2015

Something did change from 2.3.3 , one of the extensions
I assume is shortcodes or builder

Page on 2.3.3 http://prntscr.com/7vtk9f

Page on 2.4.1 http://prntscr.com/7vtkjk

I found old 2.3.3 install , updated unyson , no change
than updated extensions and css was gone

@danyj danyj reopened this Jul 22, 2015
@ghost ghost self-assigned this Jul 22, 2015
@ghost
Copy link

ghost commented Jul 22, 2015

How to reproduce? Send me the theme to moldcraft[at]email.com? (but I will debug it tomorrow)

@danyj
Copy link
Contributor Author

danyj commented Jul 22, 2015

@moldcraft cant send the theme since is to broad , will try to make a demo of the bug but just stepping back to old shortcodes extensions gives me the idea that you did change order of some files since if I use old shortcodes extension I get Fatal error: Extension "page-builder" is already defined

@danyj
Copy link
Contributor Author

danyj commented Jul 22, 2015

OK bud , email sent with modified scratch ,

instructions ,

install unyson 2.3.3
Create new page with section/column and special heading inside
http://prntscr.com/7vtxdi
http://prntscr.com/7vtxi3

your special heading should look like this

http://prntscr.com/7vtyk5

the mod produces dynamic inline css http://prntscr.com/7vtz3z

than lookup

themes\scratch-parent\inc\static.php  from line  129 

you can find this

/* THZ custom CSS */
$add_css = '/*dynamic css*/';
$add_css .='a{color:#ff6600;}';

// cssinhead
if(isset(ThzDochead::getDocument()->dochead['cssinhead'])){ 
    $add_css .= implode(ThzDochead::getDocument()->dochead['cssinhead']);
}

wp_add_inline_style( 'fw-theme-style', $add_css );

the class-thz-dochead.php class is inside includes

now open

themes\scratch-parent\framework-customizations\extensions\shortcodes\hooks.php

on line 16 find

/*
    custom css for special headings

*/
function _thz_special_heading_css($data) {

    $add_css = ".fw-special-title{color:red;}.fw-special-subtitle{color:blue}";

    ThzDochead::getDocument()->addCssInhead( $add_css );

}

add_action('fw_ext_shortcodes_enqueue_static:special_heading','_thz_special_heading_css');

now update to 2.4.1 and update extensions

the styles for special heading will be gone
only this will stay

/*dynamic css*/a{color:#ff6600;}

@ghost
Copy link

ghost commented Jul 23, 2015

I added fw_print() in

  1. {theme}/inc/static.php
  2. {theme}/framework-customizations/extensions/shortcodes/hooks.php

they were executed in the order as above.

If found the change/problem.

A solution would be to move the code from {theme}/inc/static.php to {theme}/inc/hooks.php

function _action_theme_enqueue_dynamic_scripts() {
    /* THZ custom CSS */
    $add_css = '/*dynamic css*/';
    $add_css .= 'a{color:#ff6600;}';

    // cssinhead
    if (isset(ThzDochead::getDocument()->dochead['cssinhead'])) {
        $add_css .= implode(ThzDochead::getDocument()->dochead['cssinhead']);
    }

    wp_add_inline_style( 'fw-theme-style', $add_css );
}
add_action('wp_enqueue_scripts', '_action_theme_enqueue_dynamic_scripts', 
    99 // <--- Must be greater than http://bit.ly/1SDXLLl
);

@ghost ghost closed this as completed Jul 23, 2015
@danyj
Copy link
Contributor Author

danyj commented Jul 23, 2015

💯 thank you!

I just moved the class calls for google fonts and cssinhead and it works. I just hope that this will be the final move.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant