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:
- Adding first / last CSS classes to menus
- WordPress Admin Bar pushed Sticky Footer off the bottom of the page
- How to target with css, admin elements according to user role level?
- “wp_enqueue_style();” don’t load new edited style
- Best way of adding CSS which can be manipulated by the user via theme option panels?
- functions.php not adding css to website?
- WordPress Customizer not setting default value upon initial install?
- if file_exists not working with wp_enqueue_style
- Using PHP to toggle stylesheet and header image, set in cookie
- Archive dropdown styling not applied
- Different background-image by category
- Add a Different CSS Class Into The Body Tag of Different WP Pages
- Show post in slider
- How can I hide Home in my menu in a specific page?
- Slider loading issue
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- how to remove metadata from the posts of my blog?
- How to style options page in dashboard?
- Theme Options Page – User Updates Logo
- Dynamic Stylesheet loads but doesn’t finish
- How to add condition in wordpress loop? [closed]
- Customize position of social icons in upme plugin [closed]
- Css loads very slow [closed]
- How create a Shortcode with hover and complex options
- WordPress Multiple Navigation bars
- two columns of posts on homepage, one of them “favorites”
- Which is the correct way to conditionally enqueue a CSS file?
- Custom Background by Page IDs
- Change CSS based on is_user_logged_in
- Styling the second sidebar
- How to add drag and drop functionalities to a div inside option panel
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- Where can I find the inline-css of my theme header?
- Menu Custom Data Attributes
- Highlight the links without using dropdown
- Add New Text Box To WordPress Twenty Seventeen Header
- How to modify mobile nav menu text in theme
- Website completely messes up when logging out
- Need help removing […] after excerpt
- Dividing the loop to style post differently
- jQuery accordion menu
- Twentyfifteen style author comment
- Extend Menu Walker Output
- How to add new CSS file to new PHP file
- conditional: if is page, and all subpages
- wp nav menu: show submenu below li item
- Styling an “active” link outside of WordPress default menu
- I get “Cannot modify header information – headers already sent” when I change my theme
- How to edit background color of only one sidebar?
- How to sort posts by active category in WordPress?
- How to find which .mo file is responsible for displaying a particular localized string?
- Background image no longer fits to screen now that project is in php files
- Add css class to string
- Removing links from Grouped products
- How to make only the valid active page of a multilevel menu active with – “.nav li.current-menu-item a”?
- WordPress custom php script to match standard page layout
- 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?
- admin panel – How to remove “delete” button from category editing page
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- I cannot find the wordpress.scss file that my live site is pulling from
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- I have a lot of JavaScript erorrs after SSL someone can help me?
- register dependency css and js inside a plugin class
- Hide author from search results meta, still display date and categories
- How to locate parent theme functions and add functions to my wordpress child theme?
- Add my footer menu to the header
- Make a full-width wordpress page
- Bring Font Awesome icons inside menu A tags
- Trying to add get_the_title hook to this line
- custom field – changing an element or background of id div – different versions not working
- How to display post_content from database in different on template page?
- remove blank space where sidebar was
- user update profile for custom code
- Display specific main Sub Nav on Woocommerce product pages
- Relative post date in recent posts list
- Widget edit and add in any page
- Styling admin page rows in order of importance (checkboxes)
- How to save the output of php variables used in inline css code to the main style.css?
- Show contact 7 form in popup
- featured post as div background
- Combining fancybox with multiple thumbnail plugin
- Trying to customize wordpress drop down categories
- Show Nav Link To Users Signed In
- Converting Menu Links to List Elements
- PHP Puzzle: Unique Styles with PHP loop
- Load files content [closed]
- Integrating CSS Into a WP Function Call [closed]
- WP_Query not returning results
- Predefine Magazine Style Layouts
- It’s not showing full content for posts pages in wordpress “[…]” while customing some changes in the style.css file [closed]
- Add a “Next Post” & “Previous Post” styled button manually to a post
- How do I link the side images?
- 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?
- How do I make a shortcode to display Dokan seller badge list?
- Live Preview while customizing is not showing the updates while editing in WordPress
- Calling a PHP function from a menu item