Search and Replace Script Loader in Head Only Works in Footer

Can you try this, it was what I tried to explain in my comment. Again, this is just a guess. function js_async_attr($tag){ // Add async to all remaining scripts return str_replace( ‘ src’, ‘ async=”async” src’, $tag ); } add_filter( ‘script_loader_tag’, ‘js_async_attr’); function remove_js_async_head(){ // function to add async to all scripts remove_filter( ‘script_loader_tag’, ‘js_async_attr’); … Read more

To make some div display for a longer time

Since WordPress 3.5, there are build in time constants to make thing easier for you. They are MINUTE_IN_SECONDS HOUR_IN_SECONDS DAY_IN_SECONDS WEEK_IN_SECONDS YEAR_IN_SECONDS You can probably do 30 DAY_IN_SECONDS for a 30 day period or 4 WEEK_IN_SECONDS for a 4 week period. Obviously, for a 2 month period you will do 60 DAY_IN_SECONDS

previous_post_link inside of a function?

previous_post_link() and next_post_link() should work inside the the_content filter. There is nothing wrong with your code except you must return the value inside the filter instead of print. Otherwise I believe post link should be there at the beginning of content. previous_post_link() and next_post_link() print the output so consider using get_previous_post_link() and get_next_post_link(). function prevnext( … Read more

Trying to Add a LEFT Sidebar?

I added after get_header(); ?> <aside id=”secondary” class=”left-sidebar widget-area” role=”complementary”> <?php dynamic_sidebar( ‘sleft’ ); ?> </aside><!– .sidebar .widget-area –> Then aside#secondary { width: 20%; float: left; margin-right: 15px; } Now… if you’re going to have both sidebars, you’ll have to adjust the @media screen and (min-width: 61.5625em) body:not(.search-results) article:not(.type-page) .entry-content { float: left; width: 50%; … Read more

Pass arguments to function class with do_action()

If you want to apply the add_action and do_action in combination with class object, you have to use a static function to access your class. Try this code with your own wording/variables: class My_Plugin { protected static $_instance = null; // Static function used to access this class public static function get_instance() { if ( … Read more

Newest comments first not working

You have no need callback function. Only reverse_top_level: true is find for what you want to do. Just remove ‘callback’ => ‘custom_comments_callback’, from your array. <?php wp_list_comments(array( ‘reverse_top_level’ => true, ‘avatar_size’ => 50, ‘reply_text’ => ‘Reply to this comment’ )); ?>