Adding css and js to a blank page created with custom template

In my theme functions.php at the end works for me: function themesCharles_enqueue_style() { wp_enqueue_style( ‘my-theme’, get_template_directory_uri() .’/myFiles/myStyle.css’, false ); } function themesCharles_enqueue_script() { wp_enqueue_script( ‘my-js’, get_template_directory_uri() .’/myFiles/myScript.js’, false ); } add_action( ‘wp_enqueue_scripts’, ‘themesCharles_enqueue_style’ ); add_action( ‘wp_enqueue_scripts’, ‘themesCharles_enqueue_script’ );

Dynamically determine URI to scripts and styles included with a class which could be added from plugin/theme/child theme/mu plugin

For plugins it is: $plugin_url = plugin_dir_url( __FILE__ ); This works even if wp-content is on a separate domain. You may get problems if your class is in a subdirectory of the plugin – you should probably make the __FILE__ a parameter for a function: public function get_plugin_url( $base = __FILE__ ) { return plugin_dir_url( … Read more

Socialite not displaying icons [closed]

kaiser pointed me to firebug (FF addon) which confirmed what I thought, the css/js files were not being loaded correctly. But everthing seemed ok. I copied the css into my main styles sheet and things started to look better (however, some things still didnt work). I re-did the tutorial (for the fourth time), but this … Read more

Javascript block in Twenty Twelve theme

By default when you use wp_enqueue_script the script is inserted into the <head> section. This is usually set in functions.php. The argument also has a footer option called $in_footer, if you set this to true, the scripts will instead be added to the footer section. In TwentyTwelve there are several calls to wp_enqueue_script with footer … Read more

Ajax navigation and scripts loaded only on certain pages

If the plugins are nice about it and register all of their scripts upfront, and then just enqueue them as needed, you should be able to enqueue all of them to load all the time. Find out the handles they were registered with and enqueue them. add_action(‘wp_enqueue_script’, function() { wp_enqueue_script(‘example-handle’); wp_enqueue_script(‘another-example-handle’); }, 20); However, some … Read more

Auto create description in post

You need to use save_post_post hook and use $wpdb->update() method. The code – add_action( ‘my_save_post_post’, ‘save_post_post’ ); function my_save_post_($post_ID, $post ) { global $wpdb; $post_content=”You are viewing “. $post->post_title .’! These are great hairstyle designs in our ‘. get_the_category_list( ‘, ‘, ”, $post_ID ) .’ section. Hope you try this look and feel on your … Read more

Make different sites on multisite reference same script

Hi this is what I did to solve it: add_filter( ‘script_loader_src’, ‘change_src’ ); add_filter( ‘style_loader_src’, ‘change_src’ ); function change_src( $url ) { if( is_admin() ) return $url; // Don’t filter admin area return str_replace( site_url(), ‘www.mysite.com/mydefaultnetworksite’, $url ); } I’m using both those filters because I want it to apply to script and stylesheet urls. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)