Custom CSS without css.php file

There’s two ways that this can be done. Write CSS File The first option would be to write your CSS file after the user chooses the custom font. I’m guessing that your theme will have an options panel of some sort. When the user submits the data, the new CSS file would be created using … Read more

getting url in wp_enqueue_style

To enqueue extra styles you should place the following code in your functions.php function my_custom_styles() { wp_enqueue_style( ‘custom-style’, get_stylesheet_directory_uri() . ‘/custom_style.css’); } add_action( ‘wp_print_styles’, ‘my_custom_styles’ );

Adding another “Add Post” button to admin

Unfortunately this isn’t possible (without a slight hack)- since there are no hooks provided (see for example the edit.php page). A quick and easy hack is to use JavaScript to add the link after the usual ‘Add New’ link. Here I’ve used the admin_print_footer_scripts hook (on ‘post’, or ‘edit-post’ screens) to print the JavaScript. Note … Read more

Custom Admin CSS styles to style media uploader?

Its likely that you’re not enqueing your CSS file to be used in the admin area, however you did not say. Anyway, this is what you can do… Place the following into your functions.php file: add_action( ‘admin_print_styles’, ‘my_admin_css’ ); add_action( ‘wp_enqueue_scripts’, ‘my_admin_css’ ); function my_admin_css(){ if( is_admin() ) { wp_enqueue_style( “media_upload”, get_bloginfo(‘template_directory’).”/css/custom_admin.css”, false, false, “all” … Read more

CSS file not registering through add_action

The primary issue is an incorrect template conditional tag: if( is_page( ‘home’ ) ) {} This returns true if the current context is a static page, with the slug home. I presume that you’re actually wanting to test for the Site Front Page – in which case you need to use the is_front_page() conditional: if … Read more

Remove Genericons Helper CSS from twentyfourteen theme

First of all, you’re trying to deregister a stylesheet that doesn’t exist. Here is how the genericon stylesheet is enqueued in twenty fourteen wp_enqueue_style( ‘genericons’, get_template_directory_uri() . ‘/genericons/genericons.css’, array(), ‘3.0.2’ ); You are trying to dequeue the stylesheet file name. Here is the wp_enqueue_style() function wp_enqueue_style( $handle, $src, $deps, $ver, $media ); The important part … Read more

How to add 10 different css class to posts

Use the function post_class() in your template: <div <?php post_class(); ?>> // your post content </div> Then add a counter to the post classes per filter on post_class: // functions.php add_filter( ‘post_class’, function( Array $classes ) { static $number = 1; $classes[] = ‘post-number-‘ . $number++; // reset the number if ( 11 === $number … Read more