Articles of stylesheet

Looking for methods to Check if File Exist

I’m working on a custom theme framework for educational purposes. I basically have a header.php in a child theme that i want to make smarter. I’d like to only include a stylesheet if the file exist. Getting 404 errors is not cool or efficient. Are there native php or wordpress functions to check if a […]

WordPress override bloginfo variable

How would I override a bloginfo variable in wordpress? For example, I want to replace this: <?php bloginfo(‘stylesheet_directory’); ?> to return a custom URL like http://mysites.com/hello/

What parameter should I pass to wp_enqueue_style to depend on the themes stylesheet?

I have written a basic gallery plugin that uses wp_enqueue_style to include a stylesheet on the page. I’d like for the WordPress theme to be able to override the style of the plugin which means I’d like to my plugin to play nice and output the css file before the theme css file. wp_enqueue_style has […]

Specific css on homepage, different one for other pages

Is there a way to have specific css on the homepage and use a different one for all the other pages?

Give priority to child theme stylesheet

I’ve created a child theme and the main style.css works perfectly fine. However, the parent theme has another stylesheet which I want to import and create the same for child theme and use it instead. Parent theme structure – ./woocommerce/woo.css Child theme structure – ./woocommerce/woo.css (Manually created) Now, I enqueued both the stylesheets in the […]

Child Theme Not Overriding Parent Theme

I know this question has been asked many times. I even spent the entire day yesterday getting things to work but to no avail. I am pretty sure I am missing out on something small//silly but I am unable to figure it out. So, here is my question: I have purchased the Identity-vcard theme from […]

php syntax – how to concatenate properly – echo bloginfo('stylesheet_directory)

This is driving me batty. Is my syntax wrong? Why is the first “.” in my img src call throwing out an error? This works if I put a hard link in the img src call, FYI. <a class=”blog-image” href=”<?php the_permalink(); ?>”> <?php if (has_post_thumbnail() ) { the_post_thumbnail(‘medium-size’); } else { echo ‘<img src=”‘ . […]

getting url in wp_enqueue_style

I’m having trouble getting the second argument in wp_enque_style. Here’s how my site is setup: style.css custom_style.css index.php In a template, I have this code: $stylesheet_url = bloginfo(‘template_directory’) . ‘/custom_style.css’; wp_enqueue_style( ‘custom_style’, $stylesheet_url ); Which isn’t working. Any reasons why? The output is just the path to my template directory, outputted as raw text, which […]

Can't edit style.css in subdirectory of my theme?

I want to edit a file style.css but the theme editor shows this: /* ———- Reset Tags ———– */ @import url(“css/reset.css”); /* ———- Reset Tags ———– */ @import url(“css/prettyPhoto.css”); /* ———- Shortcodes ———– */ @import url(“css/shortcodes.css”); /* ———- Site Styles ———- */ @import url(“css/style.css”); Is there any way to edit css/style.css via the Theme Editor?

To enqueue or not to enqueue

What is the best way to link to a CSS file in WordPress? Method 1: Use the following whenever needed <link href=”<?php echo get_template_directory_uri(); ?>/my-style.css” rel=”stylesheet” type=”text/css” /> Method 2: Use enqueue as follows add_action(‘wp_enqueue_scripts’, ‘load_my_style’); function load_my_style () { wp_register_style(‘my-style’, get_template_directory_uri() . ‘/my-style.css’); wp_enqueue_style(‘my-style’); } Please also let me know why a certain method […]