Forum Replies Created
-
AuthorPosts
-
iamzeus
MemberAnother question, how do I add cache busting query strings of last mod to that function i Just posted?
This is my query string last mod function
// Replace Query String for Last Modified String add_action( 'wp_enqueue_scripts', 'cache_buster_styles' ); function cache_buster_styles() { // Get the stylesheet info. $stylesheet_uri = get_stylesheet_directory_uri() . '/style.css'; $stylesheet_dir = get_stylesheet_directory() . '/style.css'; $last_modified = date ( "ymd.h.i.s", filemtime( $stylesheet_dir ) ); // Enqueue the stylesheet. wp_enqueue_style( 'cache-buster' , $stylesheet_uri, array(), $last_modified ); }How to I implement that into my correct function that mos my style.css
// load styles asynchronously add_filter( 'style_loader_tag', 'style_transform_loadCSS', 10, 2 ); function style_transform_loadCSS( $html, $handle ) { if ( CHILD_THEME_NAME == $handle ) $searchArray = array("rel='stylesheet' id='$handle-css'", "type='text/css' media='all'"); $replaceArray = array("rel=\"preload\"", "as=\"style\" onload=\"this.rel='stylesheet'\""); return str_replace($searchArray, $replaceArray, $html)."<noscript>{$html}</noscript>"; return $html; }iamzeus
MemberThanks a lot, yea needed $handle as well :), ended up with this solution:
// load styles asynchronously add_filter( 'style_loader_tag', 'style_transform_loadCSS', 10, 2 ); function style_transform_loadCSS( $html, $handle ) { if ( CHILD_THEME_NAME == $handle ) $searchArray = array("rel='stylesheet' id='$handle-css'", "type='text/css' media='all'"); $replaceArray = array("rel=\"preload\"", "as=\"style\" onload=\"this.rel='stylesheet'\""); return str_replace($searchArray, $replaceArray, $html); return $html; }thanks for the help
iamzeus
MemberJust tried it but it didnt work 🙁
iamzeus
MemberIm not that tech savy into wordpress, but i see my child theme has a home.php with this code:
<?php # Force full width content add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); # Remove the breadcrumb remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); //* Display Categories add_action( 'genesis_before_content', 'sk_isotope_filter' ); function sk_isotope_filter() { $args = array( 'orderby' => 'name', 'parent' => 0 // top level categories only ); $categories = get_categories( $args ); ?> <div id="filters"> <div id="filter-cont"> <label>Secciones:</label> <select name='cat' id='cat' class='postform'> <option value="0">Todas Las Secciones</option> <?php $category = get_category(get_query_var('cat')); $cat_id = $category->cat_ID; ?> <?php foreach ( $categories as $category ) : ?> <option value="<?php echo $category->cat_ID; ?>" <?php if ($cat_id==$category->cat_ID) {?>selected="selected"<?php } ?>><?php echo $category->name; ?></option> <?php endforeach; ?> </select> <script type="text/javascript"> var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; } else { location.href = "<?php echo get_option('home'); ?>/"; } } dropdown.onchange = onCatChange; </script> </div> </div> <?php } /** Code for custom loop */ function my_custom_loop() { ?> <div id="isotope"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <!--<span class="category"><?php //the_category(', ') ?></span>--> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail('portfolio'); ?></a> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <span class="time"><?php the_time('F j') ?></span> <span class="author">Por <?php the_author_posts_link(); ?></span> </div> <?php endwhile; ?> <?php else : ?> <?php endif; ?> </div> <div class="clearfix"></div> <?php genesis_posts_nav(); ?> <?php } /** Replace the standard loop with our custom loop */ remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_loop', 'my_custom_loop' ); //* Remove the post meta function for front page only remove_action( 'genesis_after_post_content', 'genesis_post_meta' ); genesis();Any ideas how to integrate this into my http://www.example.com/home2 http://www.example.com/home3. And yea from there ill use post or body classes to make my A/B tests using google analytics experiments
May 5, 2015 at 1:00 pm in reply to: Add 2 colors or span classes to my site-title to have different colors in my tit #150257iamzeus
MemberThanks a lot, just what i needed
January 20, 2015 at 2:33 pm in reply to: Randomize a Hook Function in my functions.php to A/B test an ad #138122iamzeus
MemberSomething like:
add_action( 'genesis_meta', 'randomhook' );
function randomhook() {
$option[0] = add_action('genesis_after_header', 'topadd0');
$option[1] = add_action('genesis_before_loop', 'topadd1');
return $option[rand()%count($option)];
}But this one isnt really working
January 18, 2015 at 8:15 pm in reply to: Move Style.css stylesheet to the footer rather than header #137901iamzeus
MemberIm already inlinin the critical above the fold css, why would it be a bad idea to load the style.css later on?
Anyhow whats the easiest way to do it
January 17, 2015 at 6:06 pm in reply to: Move Style.css stylesheet to the footer rather than header #137814iamzeus
MemberTo the footer I meant
Is there a way? To test it, im using autoptimize and it puts it in the footer but ads it as a nonscript and wanna move it myself better
iamzeus
MemberMy bad, worked putting priority as 1
thanks
iamzeus
MemberMmmmm saw this guys inlined a lot of it:
http://www.smashingmagazine.com/2014/09/08/improving-smashing-magazine-performance-case-study/
to improve the rendering of the page
so wanna do the same with my critical above the fold css
iamzeus
MemberTried this already, but 'wp_head' will add it to the end of my head
I want to load if before my style.css sheet
Want to inline my critical above the fold css
iamzeus
MemberAdding this to functions.php
// Embed width
if ( ! isset( $content_width ) ) $content_width = 730;iamzeus
MemberHook worked but seems was a css wrongly set for posts
.single .content .entry in CSS was the solution for the borders
iamzeus
MemberThanks a lot
November 8, 2014 at 11:53 am in reply to: Add a hook just fo posts and avoid homepage, pages and sections #130927iamzeus
MemberThanks a lot 🙂
iamzeus
MemberDid a testing here as well:
http://gtmetrix.com/reports/demo.studiopress.com/djtBzS4Tits the theme the one that doesnt serve the scaled images, how to fix this so my mobile users dont waste huge amounts of bandwith
iamzeus
MemberChecked this and its the theme
I disabled even all my plugins to test it and its not serving scaled images
even tested the theme in gtmetrix the original one
http://gtmetrix.com/reports/my.studiopress.com/62tqhpsv
how to fix this/
iamzeus
MemberGood day
yessite is:
http://www.recreoviral.comiamzeus
MemberWow, great... that did the job, thanks a lot
iamzeus
MemberIm interested in this as well?
how did you removed it?
-
AuthorPosts