Try
background:url(<?php echo plugins_url().'/myimgfolder/my_img.png'; ?>) no-repeat <?php echo $x_position.' '.$y_position; ?>;
It will allow you to echo the PHP elements into your style.
EDIT:
You also need to close the file, you’re trying to mix unwrapped PHP with your CSS. Your PHP variables aren’t escaped either. I’ve tested the code below, and it works fine:
<?php
header('Content-type: text/css; charset: UTF-8');
$x_position = 0;
$y_position = '-40px';
?>
.blugin_box{
width:140px;
height:140px;
background:url(<?php echo plugins_url().'/myimgfolder/my_img.png'; ?>) no-repeat <?php echo $x_position.' '.$y_position; ?>;
}
I suggest using:
error_reporting(E_ALL);
ini_set('display_errors', 1);
While you’re debugging so that you can see any PHP errors on screen, or check your log files 🙂
Related Posts:
- the_author_posts_link css class
- WordPress Shortcode and Dynamic CSS
- Need help on WordPress and php
- wp enqueue style and style sheet depth
- CSS saved & enqueued, but wordpress doesn’t load css text, only file
- WordPress loop specific thumbnail size
- Is it possible to use the featured image of a page as a css background without inlining?
- How to display a value from a radio button in the options menu in wordpress
- How should I best target dynamically served content?
- How to scale image with equal width and height without distortion?
- php syntax – how to concatenate properly – echo bloginfo(‘stylesheet_directory)
- WordPress override bloginfo variable
- Shortcode content output but not in correct place
- An unwanted inline style is added to my body tag
- Problem adding class to body_class
- Add a custom stylesheet for BlackBerry
- Get different images for mobile and desktop with php, advanced custom fields without using js and ajax
- How to stop featured image thumbnail [set as background image] on blog index page just repeating same image across all posts
- Selectbox in admin panel function linking to CSS
- Using if/else statements with output from theme options
- How to display pictures from database?
- Gravity form built in Captcha
- How does wp_enqueue_scripts work?
- Different post styles depending on category
- two columns of posts on homepage, one of them “favorites”
- Whats the proper way to use a php stylesheet in a wordpress theme? [duplicate]
- custom css for admin only
- responsive.css in the WordPress should be prioritized
- WordPress style.css not updating, only after theme reload
- Adding logo to WordPress header
- Thumbnails appear to be zoomed
- height should be set to auto to avoid pixelation in the post thumbnail function
- Odd / Even posts add class minus first post
- Add Codepen animation as Preloader to WordPress
- Reduce size of responsive title
- WordPress archive page showing 404 Error [duplicate]
- Clickable image link sends people to wrong URL
- Creating a mobile site by adding a new class to the body tag from functions.php
- How to add drag and drop functionalities to a div inside option panel
- Removing WordPress Footer -without access to PHP code?
- CSS change in woo commerce Place Order Text [closed]
- Post repeated when opening in overlay, how do I solve this? [closed]
- Add New Text Box To WordPress Twenty Seventeen Header
- Split site title and apply different classes
- Extend Menu Walker Output
- Dynamic CSS through PHP issue
- Assign Custom classes to every Excerpt
- How to make changes to style.php [closed]
- conditional: if is page, and all subpages
- Adding a navigation page state to individual blog and portfolio pages
- Inline CSS header style priority function.php Child (no enqueing I think)
- How to put search bar & logo in the “primary navigation” storefront theme?
- Create Columns with Custom Walker and CSS Classes
- How to add a CSS class to this php code [closed]
- Why would the child theme load in the Customize preview, but not on the site itself?
- How to make only the valid active page of a multilevel menu active with – “.nav li.current-menu-item a”?
- echo cutom css code to WordPress page template file ? is this safe?
- Use CSS tag inside PHP code
- I can’t go to the page archive-{post_type}.php
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- Warning: Use of undefined constant all – assumed ‘all’ (this will throw an Error in a future version of PHP) in C:\Users\…….. on line 6
- Trying to generate a CSS file in wordpress uploads folder
- WP Website is shown in HTML
- I got big white screen when i attach main style sheet of Html in functions.php
- register dependency css and js inside a plugin class
- how to add functions to my function.php using a child theme?
- Replace header with large image on home page only, using Genesis child theme
- Add a default style if no Featured image is selected
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Styling a specific post after hovering over it
- Using Sprit-sheet on WordPress categories
- Add class for the_post_thumbnail_caption()
- custom field – changing an element or background of id div – different versions not working
- How to include different html tags in the header for different pages?
- CSS loading as empty file in Custom Theme
- How limit the width of a fixed menu-bar on scroll?
- Font-Family does not looks like how it should be [closed]
- Where to find the html for WordPress site? [closed]
- How to add style in functions.php depending on conditions?
- How to remove image on single product and get product to span page?
- widget: input the px value from user and use it as inline style in widget function
- Modify arguments for parent theme’s `wp_register_style` via child theme
- Hide button based on PHP result
- How to have Function of a plugin using global vars into a shortcode?
- Child theme not working properly
- How Can I Center the Logo in the Navigation Menu? [closed]
- Cant get theme to change footer color through theme customizer
- Changing 2011 theme header image based on user dropdown
- How to change the menu color
- Converting Menu Links to List Elements
- How to change a specific character in a theme option value – replace a space with a plus sign
- How to get shared CSS body class between translated WPML pages [closed]
- How to customize posts in WordPress by using HTML and CSS?
- How to create and add js and css file when server is not on my PC?
- which php or css file has generated an inline style in WordPress that overwrites my css
- Header location [closed]
- Blog listing not showing dates for every post and arrow missing off image
- How to create a container in php then customise it in CSS
- WooCommerce Checkout Cart [closed]
- How to create different templates for woocommerce single-product.php?